Marcus Rojo's stunning finish four minutes from time kept Lionel Messi and Argentina's World Cup hopes alive to see off Nigeria 2-1 on Tuesday and set up a last 16 meeting with France.
Messi's first goal of the tournament got the two-time winners off to a perfect start in Saint Petersburg, but Victor Moses's
The Manchester United defender, who had escaped conceding a second Nigerian penalty moments earlier after a controversial VAR review, thundered home Gabriel Mercado's cross to send the under-fire Sampaoli running down the sidelines amid wild scenes of celebration.
Messi missed a penalty in a 1-1 draw with Iceland and was largely bypassed in a 3-0 thrashing by Croatia that saw calls for Sampaoli to be sacked before their final group game.
However, Argentina avoided the abyss by the skin of their teeth to fight another day against the highly-fancied French in Kazan on Saturday.
Sampaoli made five changes from the Croatia game, with veterans of the Albiceleste's run to the final four years ago Gonzalo Higuain and Angel di Maria returning, but it was the recall of Ever Banega in midfield that provided the launchpad for Messi.
The Sevilla playmaker was restored to bring some order to an Argentine midfield overrun by Croatia's Ivan Rakitic and Luka Modric and proved his worth inside 15 minutes.
Banega's brilliant pass over the top of the Nigerian defence picked out Messi's run perfectly and, after cushioning the ball on his thigh, the five-time world player of the year erased the frustrations of his World Cup so far with an arrowed right-foot finish into the far corner.
Modric claimed Croatia "cut off Messi" in Nizhny Novgorod five nights ago, but he was back to close to his Barcelona best at the heart of all Argentina's best moves in a positive first 45 minutes.
Higuain just couldn't flick the ball beyond the onrushing Francis Uzoho from a
Argentina escaped just before the break when no penalty was given for Rojo's high challenge on Kelechi Iheanacho.
Nigeria felt that injustice was rectified just five minutes after the break, though, when this time Turkish referee Cuneyt Cakir did point to the spot when Javier Mascherano tangled with Oghenekaro Etebo at a corner.
Moses confidently stepped up to send Franco Armani the wrong way on his international debut and Argentina back to square one.
Messi produced a magical performance in Argentina's final qualifier with a hat trick in Ecuador just to get his country to Russia.
But he couldn't recreate those heroics as Nigerian defenders swarmed around him everytime he was hopefully shovelled the ball by Argentine team-mates.
There was further VAR controversy when Nigeria
Ighalo missed another glorious chance when he shot too close to Armani and Nigeria were made to pay for their profligacy from the most unlikely source.
Sergio Aguero had been thrown on from the bench to join Messi and Higuain in
Chief among them was legendary 1986 World
Croatia secured first place in Group D on Tuesday after a hard-fought 2-1 win over gallant Iceland in Rostov, setting up a last-16 tie with Denmark.
Croatia wrapped up top spot in Group D in Rostov-on-Don thanks to a slick second-half volley by Milan Badelj and a late strike by Ivan Perisic, sandwiching a penalty equaliser by Gylfi Sigurdsson.