The 2-2 draw in Kaliningrad was thrilling for neutrals but exposed huge vulnerabilities in the 2010 world champions, who had to come from behind twice after careless mistakes gifted two goals to already-eliminated Morocco.
The real consequences of the sacking of coach Julen Lopetegui were laid bare in Spain's chaotic display against Morocco on Monday, which raised serious doubts about how far they can go in the World Cup despite somehow finishing top of Group B.
The 2-2 draw in Kaliningrad was thrilling for neutrals but exposed huge vulnerabilities in the 2010 world champions, who had to come from behind twice after careless mistakes gifted two goals to already-eliminated Morocco.
The usually infallible Andres Iniesta was caught out in a huge misunderstanding with captain Sergio Ramos which gave Khalid Boutaib a free run towards goal, and the usually cocksure Ramos was left looking frail again when Morocco substitute Youssef En-Nesyri outmuscled him to head in their second goal.
Spain were also let off the hook when a scorching shot from Morocco's Nordin Amrabat came off the bar, and when Boutaib failed to beat goalkeeper David de Gea after racing into the area unchallenged following a throw-in.
Spain secured the vital draw thanks to a flick of the heel from Iago Aspas in stoppage-time, a goal that was only given the green light by the video assistant referee (VAR), who had also rode to their rescue by ruling out an Iran goal in their 1-0 win.
Coach Fernando Hierro looked as if he could barely believe his luck when he charged on to the pitch at fulltime waving one finger to signal to his players that they had sneaked into first place. It is not hard to see why.
Instead of the gruelling battle with Uruguay that would have awaited them in the last 16, Spain will now play Russia, the lowest ranked team in the tournament.
If they overcome the hosts, they are likely to avoid fellow tournament heavyweights such as Brazil or France until the final.
Hierro and Isco both admitted the performance against Morocco "is not the way forward", with the interim coach showing particular concern about the five goals his side have let in over three World Cup games, contrasting with the three they conceded in 10 qualifying matches.
For now, Spain look to have escaped the harsh consequences of their confused displays in Russia, where they have rarely looked like the dominant, exciting side who swept through qualifying under Lopetegui.
Yet if they meet a team of greater quality, such as potential quarter-final opponents Croatia, they may not be so lucky, and the hasty dismissal of their former coach will be cited as chief among the reasons for their elimination.
WC PIX: Spain snatch late draw with Morocco to top group
2014 'bad boy' Suarez on road to Russian redemption
FIFA World Cup PHOTOS: Portugal held after Ronaldo misses penalty
WCup: Tehran stadium opens its doors to Iranian women for despite ban
No mercy for misfiring Messi: Nigeria coach