On a dramatic night in Kaliningrad, a late, late equaliser from Iago Aspas gave Spain a share of the points against Morocco and secured a first-place finish in Group B for La Roja.
The Spanish were expected to cruise to victory, but instead they struggled against a hard-working side in what was a pulsating, nerve-whittling encounter.
The north Africans took the lead early on after an uncharacteristic mix-up between Andres Iniesta and Sergio Ramos allowed Khalid Boutaib a clear run on goal.
The striker kept his cool and calmly slotted the ball between the legs of David De Gea, whose wait to make his first save at the World Cup was once again prolonged.
However, the Spaniards were soon level, courtesy of a magnificent trademark passing move dictated by Iniesta which was expertly finished off by Isco, who remained cool in a crowded box and cracked a finish high into the net.
Morocco continued to hound and press their opponents, with Diego Costa on the periphery throughout the game.
In the second-half, Watford wideman Nordin Amrabat almost scored a stunner, with his long-range effort coming back off the frame of the goal.
On 81 minutes, Malaga’s Youssef En-Nesyri looked to have won the game for the Moroccans, when the defender rose high above Sergio Ramos to power home a stupendous header.
As things stood, Spain were heading for a second-placed finish in the group, which would have seen them face a tricky last-16 clash with Uruguay.
Then, in injury time, sub Iago Aspas produced a sublime flick to level the scores for Fernando Hierro’s side.
The goal was initially ruled out for offside, but after a lengthy VAR deliberation, the decision was reversed, with Spain retaining the goal they so desperately needed.
Not surprisingly, the Moroccans weren’t impressed by the (correct) overturning of the linesman’s initial decision.
The game would end 2-2, a result which, coupled with Portugal’s 1-1 draw with Iran, saw the rather lacklustre Spaniards finish top of Group B, meaning hosts Russia will be waiting for them in the last 16.
As for Herve Renard’s Moroccan side, they produced an outstanding display which almost earned them a memorable win.
So close, yet so VAR.