Spain booked a last-16 World Cup clash with hosts Russia after a last-gasp 2-2 draw against already eliminated Morocco in Kaliningrad.
The 2010 champions started Monday on top of Group B but seemed certain to slip below their Iberian rivals in the final table as both matches entered stoppage-time with Portugal and Morocco leading.
Spain went behind when Andres Iniesta and captain Sergio Ramos somehow allowed Khalid Boutaib to seize upon a loose ball and run clear to score Morocco’s first goal at the finals since 1998.
Iniesta soon made amends, though, skipping through the Morocco defence to set up Isco for a quickfire leveller, with La Roja unable to break down their opponents despite dominating.
When Morocco substitute Youssef En-Nesyri got up highest to thump home a brilliant header from a Faycal Fajr corner with nine minutes to go, Herve Renard’s men looked set to claim a memorable victory.
But after another substitute, Iago Aspas, tucked in a superbly improvised finish that survived a lengthy VAR review for offside, while Iran struck a late penalty, La Roja somehow finished top of the group.
Spain showed signs of their bewitching best in possession but Fernando Hierro’s side must show serious improvement in the knockout stages if they have ambitions to claim their second World Cup.
A testy start to the game saw Gerard Pique perhaps fortunate to avoid punishment for a two-footed lunge on Boutaib.
Morocco’s lone forward then gave his side a shock lead in the 14th minute, capitalising on a terrible mix-up between Ramos and Iniesta.
The duo’s shared lapse in concentration allowed Boutaib to steal possession on the halfway line, burst through on goal and slot a neat finish through the legs of David de Gea.
That goal proved Spain’s wake-up call, Iniesta and Diego Costa combining quite brilliantly to set up Isco for a slammed close-range finish that levelled the scores five minutes later.
Boutaib scampered clear again in the 25th minute when Morocco took a quick throw-in, but De Gea – beaten from all four shots on target he had faced at the World Cup – stayed tall to save.
Morocco threatened to lose their discipline with Nordin Amrabat, Manuel da Costa and Moubarak Boussoufa all booked in a tempestuous three-minute period before Sergio Busquets planted a free header from Isco’s corner over the crossbar.
Pique was lucky again early in the second half when the defender appeared to handle the ball in the box, with Morocco agonisingly close to regaining the lead in the 55th minute.
Given space to let fly from at least 25 yards out, Amrabat’s strike had De Gea completely beaten but the goalkeeper gratefully saw the ball bounce off the woodwork.
Isco thought he had added to his nine Spain goals scored since the start of 2017 with his looping header dipping under the crossbar, but Romain Saiss made a sensational clearance, Pique heading wide from the resulting Isco corner.
Hierro introduced Marco Asensio and Aspas as Spain sought a late winner but Morocco’s determined defending held them at bay.
Although only Iran shocking Portugal could have dumped Spain out, En-Nesyri thundered home a stunning header that left De Gea helpless again.
And when Aspas turned home Dani Carvajal’s cross after a short corner – the goal given by VAR after a long delay, Spain were level in the first minute of added time.
With more high drama elsewhere – Karim Ansarifard smashing home an equalising spot-kick for Iran – Spain leapfrogged Portugal to Group B’s summit and will now play Russia in the last 16.
Meanwhile, Cristiano Ronaldo’s missed penalty cost Portugal first place in its World Cup group.
Portugal finished second in Group B after a 1-1 draw with Iran on Monday. The 2016 European champions will next face Uruguay on Saturday in the round of 16.
Instead of Ronaldo, it was Ricardo Quaresma who scored for the Portuguese. The 34-year-old midfielder responded to his first start of the tournament by producing one of the more aesthetically pleasing goals of group play.
Quaresma became Portugal’s oldest scorer in World Cup play by hitting a curling shot from the edge of the penalty area that went beyond the reach of diving Iran goalkeeper Ali Beiranvand.
Quaresma’s goal came on a night when Ronaldo — who had scored all four Portugal goals in its first two games of Group B play — was denied on a penalty by Beiranvand.
Karim Ansarifard scored a late penalty for Iran, which need to win to advance but couldn’t break through a second time despite a furious charge in the waning minutes.
Spain won the group after its 2-2 draw with Morocco. Both Spain and Portugal had a goal difference of plus-1, but Spain scored six goals in its three group matches while Portugal had five.
Spain will next face host Russia on Sunday in Moscow.
Quaresma had never scored in a World Cup game; he had nine international goals in 78 previous appearances. But his goal had all the flare of a Ronaldo strike. He sent the shot with the outside of his right foot right into the far corner near the end of the first half.
Not bad for someone who had played little more than 20 minutes as a substitute in Portugal’s first two games. Ronaldo certainly looked impressed, wrapping his right arm around Quaresma’s shoulders as he roared and raised his left fist into the air.
Ronaldo has now missed six of his last 14 penalty kicks, but he wasn’t the only big star to miss one in this tournament. Argentina forward Lionel Messi also was denied in his team’s opening draw against Iceland.
Ronaldo’s penalty was awarded after the use of video review following an apparent takedown of the Portugal forward by Saeid Ezatolahi in the area. The Iranian team, already aggrieved by the replay system overturning a goal against Spain, reacted angrily. Players swarmed Paraguayan referee Enrique Caceres, who initially had waved play on after Ronaldo went down.
Beiranvand made it a moot point, but normally defensive-minded Iran still needed to score multiple goals to advance, and they were unable to do so against a squad that won the 2016 European Championship by virtue of its own strong defensive play.
Iran has now been to five World Cups — all since 1978 — but has yet to advance out of group play.
Its players collapsed on the field at the final whistle while Portugal’s somewhat muted celebration had more the look of relief.
*Culled from AP