Postpublished at 17:35 Greenwich Mean Time 6 December 2022
One last time... here's our guide on how to take a spot-kick in a World Cup penalty shootout.
Sarabia, Soler and Busquets all miss penalties for Spain
Bono the hero for Morocco with two saves in the shootout
Hakimi sealed victory with chipped Panenka penalty
Game of few clear chances ended goalless after 120 minutes
Morocco will face Portugal or Switzerland in quarter-finals on Saturday
Emlyn Begley
One last time... here's our guide on how to take a spot-kick in a World Cup penalty shootout.
Morocco 0-0 Spain
To penalties we go.
Morocco 0-0 Spain
It hit the post in fact! That's how close Spain were to the quarter-finals.
Morocco 0-0 Spain
Pablo Sarabia flashes a volley from a tight angle wide. That was the last chance surely.
Morocco 0-0 Spain
Pablo Sarabia's corner is cleared.
Morocco 0-0 Spain
One of Morocco's key men today has been midfielder Sofyan Amrabat - he's been everywhere.
Amrabat has broken up more trouble than a nightclub bouncer, shown in this graphic by the number of tackles, interceptions, blocks and clearances he has made.
Morocco 0-0 Spain
Jawad el Yamiq almost turns a cross into his own net! Corner to Spain though.
Morocco 0-0 Spain
Sergio Busquets' shot from the edge of the box is blocked by Romain Saiss.
Morocco 0-0 Spain
They couldn't score in 120 minutes, I don't know what they'll do with three.
Morocco 0-0 Spain
Three final minutes added on.
Morocco 0-0 Spain
Morocco bring on Badr Benoun for Azzedine Ounahi. For penalties surely.
Morocco 0-0 Spain
That is Nico Williams' last touch. The substitute is replaced by Pablo Sarabia for the penalties.
Morocco 0-0 Spain
Corner to Spain as Nico Williams' cross is headed behind by Achraf Hakimi. Nope actually, the ball went out of play first. A whole other Japan debate if that had led to a goal.
Morocco 0-0 Spain
Such a waste from Alvaro Morata. Nico Williams finds the striker, who runs down the field and has about four options - or he can shoot. He plays the ball too late and too hard for Ansu Fati.
Morocco 0-0 Spain
Chris Bevan
BBC Sport at Education City, Qatar
Whatever happens next, Morocco's fans have been brilliant today - whether it be singing, drumming or whistling, they've been louder, for longer, than any other supporters at this World Cup. They have played a huge part in getting their team this close to the quarter-finals.
Morocco 0-0 Spain
Andy Cryer
BBC Sport in Qatar
If this goes to penalties, it is going to be one intimidating atmsophere for Spain to deal with.
It's loud enough as it is. The Moroccans are roaring their side home.
Morocco 0-0 Spain
Pat Nevin
Former Scotland winger on BBC Radio 5 Live
Walid Cheddira does run out of gas at the end there but he has given Rodri and Aymeric Laporte something to think about.
He will keep making those runs. He has made two of them now and still not got a shot away.
Morocco 0-0 Spain
Walid Cheddira could get in the Spain team with this lack of end product.
Morocco 0-0 Spain
Oh Walid Cheddira. For the second or third time he's not made the most of a run at goal. He doesn't have the pace or composure and Rodri stops him in the box.
Morocco 0-0 Spain
Spain still aren't doing much with the ball.