Lionel Messi came to the rescue as Argentina battled back to beat Ecuador and secure their place at the 2018 World Cup in Russia.
Messi’s hat-trick sealed a 3-1 victory but, much like the rest of their qualifying campaign, Argentina did things the hard way.
The 2014 runners-up began the day sixth in the group and needing a top-four place to qualify automatically.
They made a terrible start in Quito, losing a goal inside 38 seconds, but Messi struck twice by the 20-minute mark to put his team ahead.
A fine solo goal in the second half sealed the victory and Argentina’s passage to Russia.
Elsewhere in South America, Chile are out after losing 3-0 in Brazil.
The five-time winners and Argentina will be joined in Russia by Uruguay and Colombia.
Peru finished fifth in South American qualifying and will now meet New Zealand in a two-legged play-off.
The United States failed to progress from the CONCACAF qualifying section after losing to Trinidad & Tobago.
The USA started the night in the third qualifying place but ended up fifth after losing 2-1.
Panama jumped up to third courtesy of an 88th-minute winner against Costa Rica to reach their first World Cup finals.
European champions Portugal beat Switzerland in Lisbon to finish top of European qualifying Group B.
A draw or a loss would have left Portugal in the play-offs, but an own goal from Johan Djourou and a goal from Andre Silva took them through.
France beat Belarus 2-1 to win Group A, with Sweden finishing second despite losing 2-0 to the Netherlands.
The Dutch, who finished third in the 2014 World Cup, are out.
In Group H, Greece ensured their place in the play-offs with a 4-0 win over Gibraltar.
The European teams to qualify for the World Cup so far are: France, Portugal, Germany, Serbia, Poland, England, Spain, Belgium and Iceland.
There are four more European places up for grabs, with eight nations – Sweden, Switzerland, Northern Ireland, Republic of Ireland, Denmark, Italy, Greece and Croatia – taking part in two-legged play-offs.
Slovakia, who finished second behind England in Group F, are the nation to miss out on the play-offs as they are the second-placed side with the worst record.