Lionel Messi’s heroic hat-trick dragged Argentina back from the brink of an embarrassing World Cup exit with a 3-1 win in Ecuador.
Argentina's victory catapulted them from sixth into the automatic qualification places as they joined Brazil, Uruguay and Colombia in booking their spots in Russia.
After the shock of falling behind after 40 seconds to Renato Ibarra, Messi shouldered the hopes of an entire nation and put in one of the greatest individual performances in international football history by scoring a famous treble when it mattered most.
The four-time Ballon d'Or winner now has another crack at adding a World Cup winners medal to his CV.
Man of the match: Lionel Messi
Elsewhere, Peru's draw against Colombia was enough to secure them a play-off with New Zealand for the final spot, which meant Chile were eliminated after they lost 3-0 in Brazil.
Argentina, who have been at every World Cup finals since 1970 and twice won the tournament, knew anything other than victory would have meant elimination.
It seemed pretty inconceivable that one of football's superpowers would not make it to the World Cup - but that looked a serious possibility when Ecuador took a shock lead inside 40 seconds.
Jorge Sampaoli handed a start to Mario Benedetto up top instead of Pablo Dybala and Mauro Icardi. Antonio Valencia and Jorge Celico were both suspended for Ecuador while Enner Valencia was only fit enough for the bench.
Romario Ibarra ploughed his way through a nervy Argentina back-line and reversed a fine finish beyond Manchester United goalkeeper Sergio Romero.
Argentina, who hadn't scored in open play for 450 minutes, needed inspiration and it came from a familiar source.
Messi and Angel di Maria teamed up to devastating effect. Messi played a clever one-two with the winger before sweeping home from close range.
His influence on the game was growing by the minute and soon he'd single-handily dragged his country back into the World Cup with another sublime finish. Ecuador squandered possession, which gave Messi the invitation to pounce. He didn't waste the opportunity as he drove into the area and fired into the roof of the net, making a tricky finish look devilishly easy.
Ecuador pinned Argentina back after the break and looked the more likely to strike - until Messi waved his magic wand again on 62 minutes.
Picking the ball up about 35 yards out, he had options either side but decided to go it alone. He had a lot to do with the finish from 15 yards due to being off balance but he managed to loft a wonderful effort over the goalkeeper.
It was a goal, and performance, that defied logic and defined world-class.
One of the easier man of the match decisions. After failing to score a single away goal in the qualifying campaign, Argentina's little maestro turned it on when it mattered most with three classic finishes.
Words really don't do his performance justice. It was legendary. Without him, Argentina would be spending the summer at home.
10 out of 10 - no argument.