Morocco have reached the World Cup quarter-finals for the very first time after stunning Spain, with Achraf Hakimi producing the perfect panenka to win the penalty shootout. 

In a match where Walid Regragui's side enjoyed just 23% possession and had their backs to the wall for much of the game - despite weirdly having more shots on target - Pablo Sarabia saw his effort hit a post in the dying moments. 

Then, Sarabia struck the woodwork in the shootout as well, while Morocco goalkeeper Bono superbly saved Carlos Soler and Sergio Busquets' efforts from 12 yards to leave Hakimi with the chance to cement his hero status back home, doing so in the coolest fashion. 

La Roja dominated the ball in a frenetic start to the opening period, but the Atlas Lions were threatening on the break, using the pace of Hakim Ziyech and former Southampton winger Sofiane Boufal effectively.

Hakimi had the first meaningful chance, but his free-kick, after Boufal was brought down, went wide, while at the other end, Bono, who plays for Sevilla, was almost caught in possession by Marcos Asensio, but thankfully for him managed to clear his lines.

Spain then had two opportunities midway through the half as Dani Olmo capitalised on Bono’s slack pass, but could only find Ferran Torres in an offside position, and moments later, Asensio smashed into the sidenetting having been slipped in by Jordi Alba. 

Noussair Mazraoui stung the palms of Unai Simon shortly after the half-hour mark with the first shot on target of the contest, and the Bayern Munich right-back was in the right place to clear Gavi’s cross soon afterwards.

Morocco went into the break with their tails up as Sergio Busquets and Aymeric Laporte made vital clearing headers, either side of a flicked effort from Nayef Aguerd that just went over. 

After the restart, it was Simon's turn to have the jitters as he just managed to avoid being caught in possession before Bono had to beat away Olmo's fierce free-kick after Gavi - who became the youngest player ever to appear in a World Cup knockout match aged 18 years and 123 days - had drawn a foul from Hakimi for the second time in quick succession. 

Gavi became the youngest player to appear in a World Cup knockout game at just 18 years and 123 days

Luis Enrique blinked first just past the hour, withdrawing Gavi and Asensio for Alvaro Morata, the latter of whom scored in all three of Spain's group games against Costa Rica, Germany and Japan, while Enrique's opposite number Regragui was forced to take off Boufal after he picked up a knock, with Barcelona loanee Abde Ezzalzouli coming on in his place. 

Aguerd produced a superb slide-tackle on Morata shortly after the former Chelsea striker's introduction as Spain continued to hog the ball and Morocco worked doggedly to keep them at bay.

Nico Williams was also brought on as Enrique looked for a breakthrough and the Athletic Bilbao youngster whipped in a dangerous cross which Aguerd made vital defensive contact on, before Williams fed Morata, who fired across the face of goal from an incredibly tight angle. 

Unfortunately for Regragui, Aguerd came off with a groin problem, shortly after the 47-year-old had made a triple change to refresh his side with the game heading to extra time. 

As both team searched for a winner, Hakimi had his first chance to really stretch his legs down the right, but unfortunately his venomous right-wing cross could not be converted. 

Morocco goalkeeper Bono saves Dani Olmo's free-kick
Bono was alert to palm away Dani Olmo's teasing free-kick in the 95th minute before extra time

In stoppage time, Soler's delivery to the back post found Morata, but his header flew over, and Simon had his heart in mouth as Ezzalzouli bore down on him, but luckily for the Spain stopper, he just got his kick away. 

In the 95th minute, Bono's flying save denied Olmo's teasing free-kick and the game went to extra time.

Morocco continued to be under the cosh as the match got back underway, but they kept defend astutely, Aguerd's replacement Jawad El Yamiq slotting seamlessly into the backline. 

The North Africans went agonisingly close to breaking the deadlock as Azzedine Ounahi threaded a pass through to Walid Cheddira, who took a touch before drawing a save from Simon with his legs. 

Morocco were momentarily down to 10 men as Romain Saiss went off after clutching his hamstring, but the former Wolves centre-back somehow made it back on with the aid of some strapping as Regragui's men almost sprung another counter-attack, only for lone striker Cheddira to run out of room. 

With penalties looming, Spain had their own opportunity to break, but Morata's pass through to Alejandro Balde was overhit, before livewire Williams - who was subsequently taken off for Sarabia - forced Hakimi to head behind. 

Achraf Hakimi scores with a panenka to win the penalty shootout for Morocco
Achraf Hakimi produced the most impudent of finishes to send his side through to the last eight

Sarabia's cross brushed Soler's head with El Yamiq taking evasive action, and Sarabia then saw his volley come off the outside of Bono's far post after Rodri's clipped ball him unmarked in the box, albeit at an angle. 

Unfortunately for both sets of players, the process of penalties was triggered, but Spain had a reassuring stat on their side: the last seven World Cup shootouts had been won by the team taking their kicks second. 

However, that streak ended here. Abdelhamid Sabiri stepped up to put his country ahead before Sarabia, brought on for this moment, fluffed his lines, with Hakim Ziyech making it 2-0 and Soler being denied excellently. 

Badr Benoun ensured it wouldn't be plain sailing as his weak effort was kept out by Simon, but Busquets couldn't halve the deficit as his pre-penalty wink came back to haunt him, Bono getting down brilliantly to his right.

It was down to Hakimi to produce the ballsiest of panenkas and do a celebratory dance as his team-mates converged on him. What a win for Morocco. What a win for Africa.