In doing so, they became the first Arab nation to advance to the last eight, ensuring a breakthrough for the region in the first global tournament in the Middle East, and also became the fourth African side to go this far in World Cup history.
The ear-shattering cacophonic combination of singing, drumming, jeering and whistling from Morocco’s supporters has created an atmosphere like no other in Qatar’s stadiums.
They were again the vast majority in the capacity 44,667 crowd at the Education City Stadium, completely drowning out the Spain fans.
But most of them shuffled from one side to another, rarely producing the penetrative pass Spain were looking for.
They will however be mightily concerned to have lost centre back Nayef Aguerd, who limped off in tears in the second half, having just made the World Cup after ankle surgery kept him out for most of the season at his new English club West Ham United.