Spain described 2-2 with Morocco in Kaliningrad after twice falling behind to the north African side in a thrilling finale to Group B

In the last minute of Spain's final group game Fernando Hierro and all of Spain's subs were suddenly off the bench, frantically signalling to their players, a thumb raised on each hand, scarcely able to believe what had just happened and urgently trying to convey the news. Somehow, they did not yet know how, they had done it- or it had been done for them. Not merely had they avoided defeat with a late objective, eventually granted by VAR after an agonising wait, but another late aim 1,593 km away meant they claimed first place in Group B, technology telling them their destiny, events elsewhere deciding it.

Although Spain were never really in danger of being knocked out, first place mattered: they now travel to Moscow to face Russia rather than Sochi to play Uruguay and avoid the half of the draw likely to include Brazil, Germany, France and Argentina.” Moscow will be lovely ,” Hierro said; whatever it is, it could have been worse. On moments like these fate turns and futures are constructed. Spain, certainly, may feel like something changed here tonight. Sergio Ramos called it a “turning point”.

At 2-1 down to Morocco substitute Iago Aspas scored a 92 nd-minute equaliser that was ruled out for offside and then the referee, Ravshan Irmatov, consulted the video. All at once Spain's celebration was cut short and everything on intermission, an entire stadium in suspended animation. Minutes passed, silence falling until Irmatov pointed to the centre circle, the goal given. At the same time, everything changed a long way away, beyond their control. Another 92 nd-minute goal, this time a controversial penalty for Iran, took Spain from second place to first- and a very different path to the final.

It had seemed so implausible a moment before and for most of the night. For Portugal it was painful and for Morocco cruel again: the portrait of a World Cup at which they deserved so much more. They could barely believe it. Nordin Amrabat spat: “VAR is bullshit” as he departed. Aziz Bouhaddouz said:” We've had no luck. We've played amazingly. Last week Ronaldo had one chance and scored: that's why we lost and the refereeing was shit – sorry about my English .”

Quick guide

Dramatic night of VAR in Group B

Iran penalty appeal

74 min: Sardar Azmoun goes down after a challenge from William Carvalho. Iran wants VAR to get involved but to no avail

Morocco take the lead

81 min : Youssef En-Nesyri scores with a towering header, beating Sergio Ramos to the ball to connect with Nordin Amrabat's corner

Morocco wasting time

81 min : Munir El Kajoui Mohamedi is booked for time wasting with the Spain players increasingly riled with their foes

Red alert for Ronaldo

88 min: The forward looks fretted after an elbow on Morteza Pouraliganji but the referee, after looking at a replay, opts for a yellow

Spain back on level words

90 +1 min : Iago Aspas scores with a delightful flick. It is first ruled out for offside then, after more VAR involvement, dedicated

Iran win penalty and score

90 +2 min : Over in Saransk, Iran are given a spot kick after VAR decides that Cedric Soares handled the ball. Karim Ansarifard scores. 1-1

Portugal survive scare

90 +5 min: Mehdi Taremi is presented with an excellent opportunity five minutes in to added on time- but hits the side netting. Portugal survive

Photograph: Hector Vivas/ Getty Images Europe

Thank you for your feedback.