Spain will face hosts Russia in the last 16 of the World Cup after finishing top of Group B following a dramatic 2-2 draw with already-eliminated Morocco in Kaliningrad.
Spain, 2-1 down thanks to Morocco substitute Youssef En-Nesyri’s 81st minute header, were set to finish second and therefore take on Uruguay in the next round.
Their substitute Iago Aspas then flicked the ball into the net in the dying seconds and saw that the flag was up for offside – but the goal was subsequently given following a VAR review.
Spain had gone 1-0 down in the 14th minute when Khalid Boutaib punished a mix-up between Andres Iniesta and Sergio Ramos, before drawing level five minutes later through Isco’s strike.
While Fernando Hierro’s side – who survived a scare 10 minutes after the break as Nordin Amrabat’s strike hit the woodwork – snatched a point, Portugal were held to a 1-1 draw by Iran thanks to a late goal by their opponents.
It leaves Spain and Portugal level on five points each in first and second place, with goals scored putting the former ahead, and the latter set to face Group A winners Uruguay in the next round.