Messi single-handedly resurrected Argentina's hopes in a 3-1 win over Ecuador in Quito that drew a line under a chaotic campaign that had left the two-time champions in danger of failing to qualify.
The Barcelona superstar scored twice inside the opening 20 minutes to give Argentina the lead after Ecuador had stunned the visitors with an opening goal after from Romario Ibarra after 38 seconds.
Messi then completed his hat-trick -- the 44th of his dazzling career -- with a sublime chip in the second half to seal the victory.
The Argentinian superstar can now look forward to his fourth appearance at the World Cup at next year's finals in Russia, where he will attempt once more to lead his country to an elusive major title.
Since his country's defeat to Germany in the 2014 World Cup final, Messi has twice suffered agony at major tournaments with Argentina, losing the finals of both the 2015 Copa America and the 2016 Copa America Centenario.
Messi, who will turn 31 during next year's World Cup, now has one, perhaps final, chance to emulate his idol Diego Maradona by lifting the World Cup.
Relieved Argentina manager Jorge Sampaoli -- the third coach appointed during the qualifying campaign -- could not avoid expressing his gratitude to Messi following Tuesday's win.
"Messi doesn't owe a World Cup to Argentina -- football owes a World Cup to Messi," Sampaoli said. "He's the best player in history. This is a team victory. They played a brilliant match."
Argentina had started the day outside the automatic qualifying positions, needing to secure their first win in Quito since 2001 to be certain of claiming at least a playoff place.
It looked as if Argentina's worst fears were set to become a reality after Ibarra's opening goal in the first minute.
But it was not long before Messi stamped his authority on the game, hauling his team back into the contest with a composed opening goal.
The equaliser came in the 12th minute when Messi darted forward and quickly released Angel Di Maria down the left.
The Paris Saint-Germain attacker duly returned the favour as Messi raced into the penalty area to poke home a low finish past Maximo Banguera.
Eight minutes later Messi fired Argentina into the lead with another virtuoso strike, lashing into the top corner.
Messi then completed his hat-trick with a sublime chip in the 62nd minute to make it 3-1. But while Argentina celebrated, it was a miserable night for Sampaoli's former team Chile.
The Chileans -- winners of the Copa America in 2015 and 2016 -- were soundly beaten 3-0 by Brazil in Sao Paulo to see themselves eliminated on goal difference.
Barcelona's Paulinho opened the scoring before Manchester City's Gabriel Jesus bagged a brace to secure a win already-qualified Brazil which relegated Chile to sixth place in the standings.
The Chileans finished level on points with Peru, who secured a two-leg playoff against New Zealand, but trailed on goal difference.
Chile coach Juan Antonio Pizzi announced his resignation following the exit. "I take full responsibility," Pizzi told reporters. "We gave everything but it was not enough. I will not continue."
Peru meanwhile kept alive their hopes of qualifying for the World Cup for the first time since 1982 with a fighting 1-1 draw with Colombia in Lima.
Colombia took the lead through James Rodriguez in the 56th minute before veteran striker Paolo Guerrero equalised in the 74th minute. The result saw Colombia qualify alongside Uruguay, 4-2 winners over Bolivia in Montevideo.
Uruguay, who finished the standings in second place, were jolted by a Gaston Silva own goal which gave Bolivia the lead on 24 minutes.
Martin Caceres and Edinson Cavani scored twice just before half-time to give Uruguay the lead before two goals from Luis Suarez put the hosts 4-1 up.
Bolivia reduced the deficit when Uruguay's Diego Godin scored the second own goal of the night. In the day's other game, Paraguay's hopes of qualification evaporated in a 1-0 loss to Venezuela in Asuncion....