With Argentina facing the dire possibility of missing out on a World Cup for the first time since 1970, the brilliant captain delivered when it matter most with three goals in the rarefied air of Quito, Reuters reported.
The twice World Cup winner finished third in the 10-team South American group, going through with Brazil, Uruguay and Colombia as the automatic qualifiers, while Peru grabbed a playoff place against Oceania champion New Zealand at the expense of Chile.
Messi had not been at his best in Argentina’s stuttering campaign and failed to score in their previous three drawn qualifiers, which had left them in sixth place and out of the qualifying berths for Russia heading into Tuesday's game.
A World Cup without Argentina seemed an even bigger possibility when Romario Ibarra put Ecuador ahead in the opening minute after he got the better of Javier Mascherano and beat Sergio Romero with a low shot.
But Argentina, which had managed only one previous win in Quito, in 2001, equalized 11 minutes later when Messi tapped home after a one-two with Angel Di Maria.
Messi then put Argentina ahead in the 20th minute, firing a superb shot past Maximo Banguera into the top corner, and completed his hat-trick just past the hour, shaking off three tired Ecuador defenders before lifting the ball over the advancing goalkeeper and into the net.
"Today Argentina took a great step forward," said Argentina coach Jorge Sampaoli.
“I hope that with the time to prepare that we’ll have, we can be competitive (in Russia) like we were today.”
While Sampaoli was delighted with his captain's performance, he said the side had to stop relying on him so much.
"We've got to fix it so not everything depends on Messi," he added.
‘It would have been crazy’
"It would have been crazy a World Cup without Argentina" Messi said after his dramatic hat-trick against Ecuador.
After the match, Messi, who along with the rest of Argentina's players had boycotted the media since November 2016 as a protest against perceived mistreatment, said he had feared the worst when his side went behind, but now they could celebrate qualification, ESPN reported.
"Fortunately everything went well and we are into the World Cup," he said.
"We are calm now after achieving the main goal – that is the most important thing. All this time that we were away from the press, the fans helped us to be closer.
"It would have been crazy a World Cup without Argentina, this group didn't deserve it. The team will change, will grow a lot and will come out stronger.
"It was a relief because we were in a tough spot. We got ourselves into this mess. It was not easy to play here, a lot of things happen from my mind when the 0-1 came, but the group overcame the situation very well and was quick to take the lead.
"There was some fear of missing the World Cup. We let pass a lot of opportunities and we had to decide our future in this game. We had to qualify, now it's time to enjoy."
Messi's hat trick took him to 21 career CONMEBOL World Cup qualifying goals, breaking Hernan Crespo's record of 19, with Uruguay's Luis Suarez also matching him with a brace on Tuesday against Bolivia.