Lionel Messi booked his place in South American footballing folklore as he scored a hat-trick to inspire an escape act for Argentina as Albiceleste book their place in next summer's World Cup Finals in Russia, beating Ecuador 3-1 in Quito.

His 21 goals in qualifying mark yet another record for the Argentine, with Messi becoming the most prolific marksmen in any qualifying period of history in South America.

Jorge Sampaoli's men finish the group in third spot behind Uruguay, with Colombia finishing fourth, with their opponents Peru into the play-offs after drawing 1-1 in Lima. Chile finish sixth and go out.

Ibarra stuns visitors

With Argentina staring down the barrel of the real possibility of missing out on their first World Cup Finals since 1970 in Mexico, the visitors were however stunned within the opening minute.

After a long ball forward, forward Romario Ibarra flicked on and after non-existent defending, the Ecuadorian received the ball back, slipped round Sergio Romero in the Argentine goal and slotted the ball home to a cacophony of noise from the home fans.

Sampaoli's side had barely time to catch their breath in the thin air of the Ecuadorian capital, but were almost level within minutes after Ángel Di María twice came close to levelling with low driven shots across the penalty area.

Messi stamps his mark

The PSG winger was however involved as Albiceleste equalised. Di Maria escaped down the left and after evading a cavalier defence, squared the ball back to the waiting Lionel Messi to toe-poke home under Máximo Banguera.

Just 12 minutes had passed in Quito, but already the action was rather ironically breathless. In the build up the game, Messi had been carrying the hopes of a nation - and more. Once again the little magician delivered.

In a typically surging run from midfield, the FC Barcelona man weaved a spell on the hosts' defence and threw a dummy on the left of the area. Messi then took aim and rifled a unstoppable shot high in the top left corner of the net, to the ecstasy of the men in white and sky blue.

The 30 year-old second of the evening marked yet another his now almost infinite roll call of records, as the leading scorer in South American qualifying history, with 20 goals.

Nicolás Otamendi came close to extending Argentina's lead from a header corner, but with Ecuador still a threat on the counter-attack Sampaoli knew the work was only half done, as the whistle blew for half-time with a slender Messi-inspired cushion.

With only Brazil guaranteed a spot next summer in Russia - with countries second and seventh all vying for a place in the CONMEBOL standings - Argentina's lead was a narrow one.

Embed from Getty Images

Magician completes escape act

After the visitors resumed at pace early in the second period, the conditions in the oxygen-sapping air of the city took their toll on both sides. Then just after the hour mark, the chosen one for Sampaoli on this night struck once more, decisively.

In the 62nd minute just like for his second goal, Messi picked the ball up 40 yards from goal this time on his chest. Facing three men in yellow, the forward shrugged off his opposing defence with impudence, before baring down on the Ecuadorian goal and lofting a exquisite chip over the head of Banguera into the net for his - and his perhaps his country's - most important hat-trick to date.

His team-mates celebrated gleefully knowing the goal's importance, now within touching distance of another major world footballing competition.

The third for the visitors finished the game as contest, with both sides spent in the unforgiving climate. Whilst the Ecuadorian fans filtered away into the night, Argentina celebrated the final whistle in jubilation, having made the ultimate escape act and booking their place in Russia next summer, avoiding what had been the unthinkable.