Spain have come from behind twice to draw 2-2 with Morocco in Kaliningrad.
Due to Portugal's draw with Iran, La Roja have finished top of Group B.
Khalid Boutaib opened the scoring for Morocco after 13 minutes. The 31-year-old capitalised on some poor Spanish defending, striding towards goal before slotting between David De Gea's legs to bag Morocco's first World Cup goal since 1998.
It didn't take long for Spain to respond. Andreas Iniesta playing well beyond his years by surging into the Moroccan box then setting the ball on a plate for Isco, who took a touch and smashed the ball past Munir Mohamedi from close range.
The 2010 world champions failed to capitalise on a number of chances and were punished with nine minutes remaining as Youssef En-Nesyri restored Morocco's lead.
It wasn't to be for the African nation though as Iago Aspas scored an equaliser in injury-time.
The goal was initially ruled offside, but after consulting with VAR, the referee correctly overturned the decision.
WORLD CUP - GROUP B
Spain - 2 (Isco 19', Aspas 90+1')
Morocco - 2 (Boutaib 14', En-Nesyri 81')
Kaliningrad Stadium, Kaliningrad