In its third straight win, Argentina attacked with more flair than previously and could have scored more goals if it weren't for some good saves by Nigeria's goalkeeper Vincent Enyeama.
Ahmed Musa kept things interesting by twice erasing Argentina's lead, before Marcos Rojo kneed in the winner from a corner.
"We played against a team that wanted to play," Messi said. "I think we saw a good Argentina. We need to continue on this path."
Before the match, which saw both teams advance from Group F, Enyeama was the only goalkeeper in the tournament who hadn't conceded a goal. In Porto Alegre it took just three minutes for Messi to beat him.
Bosnia Herzegovina 3, Iran 1 • In Salvador, Brazil, Bosnia-Herzegovina ended Iran's hopes of advancing to the knockout stages, registering its first World Cup win in the process.
The Bosnians, who were already relegated from the tournament, took a commanding 2-0 lead with goals from Edin Dzeko in the 23rd and Miralem Pjanic in the 53rd before Iran hit back in a desperate late bid to qualify for the second round.
Switzerland 3, Honduras 0 • In Manaus, Brazil, Xherdan Shaqiri scored all three goals Wto put Switzerland into the second round. The Swiss will next face Lionel Messi and Argentina on Tuesday in Sao Paulo.
Shaqiri scored in the sixth minute, 31st minute and 71st minute.
France 0, Ecuador 0 • In Rio de Janeiro, France's much-vaunted attack missed a series of chances as it drew against 10-man Ecuador to reach the knockout stage of the World Cup, while the South Americans bowed out of the tournament.
France, which ended with seven points, had scored eight goals in two games and 39 in its previous 11.
Ecuador's chances were hindered at Rio's Maracana stadium after Antonio Valencia was shown a straight red card in the 50th minute for digging his studs into the leg of French defender Lucas Digne.