Atlas Lions earn a historic spot for a quarter-final clash with Portugal, who demolished Switzerland 6-1.

Morocco's goalkeeper Yassine Bounou deflects a penalty kick from Spain's midfielder Carlos Soler.
Morocco's goalkeeper Yassine Bounou deflects a penalty kick from Spain's midfielder Carlos Soler. (AFP)

Morocco have dumped Spain out of the World Cup in a last-16 penalty shootout with Achraf Hakimi scoring the decisive spot-kick, after Spain squandered all three of their attempts, following a 0-0 draw over 120 minutes.

Hakimi calmly slotted his penalty past Unai Simon in Spain's goal to seal Morocco's 3-0 win in the shootout on Tuesday evening.

Hakimi, who was born in Spain and who trained under the Real Madrid youth system, had picked to play with Morocco in the World Cup saying, he wanted to be with his parents' country of birth.

Pablo Sarabia, Carlos Soler and Sergio Busquets missed their penalties for Spain, with Sarabia hitting the post and Morocco goalkeeper Yassine Bounou stopping the other two.

The match went into extra time on Tuesday after the two sides locked at 0-0 after 90 minutes.

Morocco created the best of only a few chances in the first half, including a close-range header by defender Nayef Aguerd that flew over while Marco Asensio hit the side-netting for Spain who dominated possession but failed to show real threat. 

Opportunities in the second period were also limited.

READ MORE: Euphoric Morocco unfurl Palestine's flag after spectacular win over Spain

Spain enjoyed more than 75 percent of possession and completed almost 800 passes, but Morocco caused problems for them on the counter-attack.

It was the fourth time Spain have been knocked out of the World Cup on penalties and the second in a row.

Spain had been hoping they could repeat their 2010 World Cup triumph after reaching the semi-finals of Euro 2020, where they were also beaten on penalties by Italy.

Morocco has been the biggest surprise of the tournament and is the only team from outside Europe or South America to make it to the last eight. 

It is the only Arab — and African — nation left in the tournament.

Morocco also became only the fourth African nation to reach the last eight of the tournament, 12 years after Ghana did so in South Africa.

With the historic victory, the Moroccan team, also known as the Atlas Lions, earns a quarter-final clash berth with Portugal, who defeated Switzerland 6-1.

READ MORE: Morocco vs Spain: A contest of blurred loyalties for some football fans

Source: TRTWorld and agencies