Marcos Rojo was Argentina's unlikely saviour as the South Americans beat Nigeria 2-1 to advance to the last 16 of the World Cup.
The Manchester United defender volleyed home Gabriel Mercardo's right-wing cross four minutes from time to book a knock-out clash against France.
Nigeria had been on the verge of progressing instead after Victor Moses' penalty early in the second half had cancelled out Lionel Messi's first goal of the tournament.
In the face of mounting criticism due to his nation being on the brink of elimination, Argentina coach Jorge Sampaoli had not only changed his attire to a more conventional tracksuit but had also made five changes.
Willy Caballero, whose blunder gifted Croatia their opening goal in the 3-0 loss last week, and Sergio Aguero were two of the fall guys while Rojo, Angel Di Maria and Ever Banega were among those brought in.
And it was Banega, making his first start in Russia, who produced the assist for Messi's 14th-minute opener.
The Sevilla midfielder lofted a beautiful pass over Kenneth Omeruo, though from there it was all Messi. He cushioned the ball on his thigh and created space with a deft left-footed touch before firing into the far corner with his right.
It sent the crowd, including Diego Maradona, into delirium and at that point the two-time winners were heading through thanks to Messi's magic.
The Barcelona forward looked in the mood, with a terrific pass into Gonzalo Higuain's path deserving more than the striker's weak attempted chip over Francis Uzoho.
Messi looked capable of doing it by himself regardless and he almost scored again with a free-kick that Uzoho's fingertips pushed onto the post.
Sampaoli's side were 45 minutes from progression but they were back on the verge of going out shortly after the resumption.
They were architects of their own downfall too. Three Argentinian defenders converged on the ball and conceded a needless corner, from which Javier Mascherano, with both of his hands on Leon Balogun at the near post, was adjudged to have hauled his man down.
Moses confidently placed the spot-kick to the opposite way Argentina's debutant goalkeeper Franco Armani dived and Nigeria were back in pole position for the group's runners-up berth.
Sampaoli called for Cristian Pavon, who made a positive impression, and Maximiliano Meza, whose impact was far less great, as Aguero and Paulo Dybala waited on the bench.
A second Nigeria goal would have killed off Argentina's hopes and ex-Watford striker Odion Ighalo spurned a glorious opportunity when volleying wide.
The Super Eagles wanted a spot-kick for a handball against Rojo prior to the ball dropping to Igahlo, and though VAR looked at the incident again, no penalty was given as the defender headed against his arm.
Aguero then came on, but not for Higuain, who stabbed a clear opening way over.
Ighalo saw another try saved by Armani and Oghenekaro Etebo's free-kick went into the side netting as Nigeria missed chances to seal their progression.
And it proved costly as Rojo, of all people, won it four minutes from time.
He was way out of position when Mercardo's cross came into the box, but all of Argentina was glad he was there as Rojo steered a first-time finish into the corner to spare his country's blushes.