Marcos Rojo's late winner put Argentina through to the round of 16 at the World Cup with a 2-1 victory against Nigeria on Tuesday night.
The South Americans came into the match knowing they needed three points to escape Group D. And their talisman Messi had them in front just before the 15-minute mark when he settled an Ever Banega pass over the top of the Nigeria defence and beat Francis Uzoho to put Argentina up 1-0.
The goal snapped a 660-minute scoreless drought at the World Cup for Messi, who last scored against Nigeria in the group stage of the 2014 edition in Brazil.
Uzoho came up with two great saves either side of the half-hour, keeping out Gonzalo Higuain from close range and then getting a fingertip on a Messi free kick from just outside the penalty area that would have found the back of the net.
Nigeria were level at 1-1 through a penalty kick soon after the restart when John Obi Mikel converted his attempt from the spot after Javier Mascherano was whistled for a foul on Leon Balogun following a corner kick.
Argentina were fortunate not to concede another penalty just before 80 minutes when a headed clearance by Rojo hit off his arm, forcing the referee into a video review after which he did not give the spot kick.
Minutes later, Gonzalo Higuain missed a golden chance to put Argentina in front, but he skied his first-time effort from a Rojo cross well over the bar.
And it was Rojo that would score the winner for Argentina, smashing in a first-time volley from a Gabriel Mercado cross in the 86th minute to give his team the lead and put them through to the round of 16 for a matchup with Group C winners France on Saturday.
France won their second World Cup on Sunday with a 4-2 win over Croatia, with Didier Deschamps becoming the third person to win the trophy as a player and a manager.
Thomas Meunier scored in the opening minutes and Eden Hazard added a goal late as Belgium defeated England 2-0 in the World Cup's third-place game in St. Petersburg.
Croatia will take on France in the World Cup final -- their first ever appearance in one -- after beating England 2-1 in extra time in Moscow thanks to a Mario Mandzukic goal.
France will play in the World Cup final for the first time since 2006 after beating Belgium 1-0 thanks to a goal from Samuel Umtiti in St Petersburg on Tuesday evening.
Croatia won a second consecutive penalty shootout 4-3 to advance to the World Cup semifinals, ending the tournament for hosts Russia, who had equalised late in extra time.
England have reached their first World Cup semifinal since 1990 after goals from Harry Maguire and Dele Alli secured a 2-0 victory over Sweden in Samara.
Belgium blew away Brazil to claim a place in the semi-finals of the World Cup, with an own goal from Fernandinho and a strike from Kevin De Bruyne giving them a 2-1 win.
France reached the World Cup semifinals after a relatively straightforward win over Uruguay courtesy of goals from Raphael Varane and Antoine Griezmann.
England advanced to the World Cup quarterfinals on penalties after a 1-1 draw with Colombia on a dramatic evening in Moscow on Tuesday.