After 120 minutes where neither side could break the deadlock, it was Achraf Hakimi who emerged as the hero as he scored the decisive spot-kick to win it 3-0 for Morocco.
It's the third major tournament in a row where Spain have been eliminated in a penalty shoot-out - going out of the last World Cup in 2018 to hosts Russia in the Round of 16 and to Italy in the semi-finals of Euro 2020.
Laporte and Rodri were strong and resolute as they partnered each other in the heart of the defence, both playing 120 minutes – 90 minutes plus the extra time – but their normal time shutout wasn't enough as Luis Enrique’s men failed to make it through to the last eight.
Morocco will now go through to the quarter-finals for an encounter with either Portugal or Switzerland.
They play each other this evening, with a 19:00 kick-off at Lusail Iconic Stadium.
This game featured plenty of effort from both sides but very little in the way of clear-cut chances throughout the 120 minutes.
The first half set the tone with the best opportunity coming for Morocco on 42 minutes, West Ham’s Nayef Aguerd heading over from six yards when well placed following a pinpoint ball into the box by Sofiane Boufal.
The second half was an equally tense affair, with Spain doing most of the pressing but Morocco defending resolutely.
Dani Olmo saw a fierce 20-yard strike punched clear after the ball was played neatly to him from a free-kick wide on the left.
It was Olmo again who looked to break the deadlock on 79 minutes when he darted into the box to meet a pinpoint cross but he fired wide.
Alvaro Morata, a 63rd minute substitute, clipped one across the face of goal on 81 minutes as he tried to fizz the ball past goalkeeper Bono.
Nico Williams almost scored for Spain on 89 minutes when he ran on to Morata’s cutback but his goalbound strike was blocked in the box – and the offside flag followed soon after.
Morata headed over at the back post on 90 minutes and he’ll feel he should have done better.
Laporte showed his class on 95 minutes when he averted disaster for Luis Enrique’s men, getting in a toe to ensure the onrushing Walid Cheddira didn’t put Morocco ahead.
Spain huffed and puffed throughout the first period of extra-time after that early chance for their opponents but they couldn’t find the breakthrough despite pressure coming via the dangerous Morata and Williams.
Ironically, Morocco could – and possibly should – have opened the scoring on 104 minutes but Simon made himself big to block a goalbound effort from Cheddira.
Cheddira broke through from the left on 115 minutes but, by the time he was set to shoot, he’d been ushered off the ball by the impressive pairing of Rodri and Laporte.
Spain hit the post in the final minute of extra-time through Pablo Sarabia as he met a deep cross into the Morocco box.
It was Morocco, though, who mastered penalties as they emerged victorious 3-0 from the spot.
Pablo Sarabia, Carlos Soler, Sergio Busquets all missed from the spot for Spain while Abdelhamid Sabiri and Hakim Ziyech set up Hakimi for the winning moment.