Argentina conceded after just 37 seconds in their must-win game against Ecuador -- but Lionel Messi came to the rescue as his side booked their place at next summer's World Cup.
The number 10 hit a brace in the first half in Quito and capped off a stellar performance as he completed his hat-trick with a stunning chip over keeper Maximo Banguera just after the hour mark.
Romario Ibarra stunned the away fans -- and perhaps all of South America -- as he nodded on a ball lofted high into the danger area and sloppy defence from Argentina allowed the Ecuadorian space to slot it in past Sergio Romero in the opening minute.
But Messi, who is now the all-time leading goalscorer in South American qualifying, played a deft one-two with Angel di Maria to level things up after 12 minutes and then put his side in front eight minutes later with a strike from just inside the box.
Ecuador continued to press in search of an equaliser as Argentina failed to kill the game off, allowing the home side to attack well into the second half.
But it was a moment of brilliance which proved to be the difference.
The Argentina talisman took the ball in space about 40 yards out from goal, weaved his way to the edge of the box and was able to lob Banguera -- six yards off his line -- as he lost his balance and fell to the floor.
Argentina were looking in danger of not making the 2018 World Cup in Russia going into the final group games, following a torrid campaign in which they had only scored 16 in 17 games.
Low points were numerous, and a 2-0 loss to Bolivia in March saw the end of Edgardo Bauza's short stint as boss as Jorge Sampaoli took the reins.
Since then, three draws put Argentina on the brink of not making the World Cup for the first time since 1970.
They travelled to Quito -- a place where they have not won since 2001 -- but bagged all three points to guarantee a trip to Russia.