Brazil had the best chances of the first half, with Ronaldinho prominent on his first international appearance in 19 months, back in favour after a spell out of the team.
He linked up well with Robinho and Neymar and only a fine performance from Argentina goalkeeper Sergio Romero prevented them from opening the scoring.
Andre Santos had the first chance, shooting wide after a free-kick from Ronaldinho. A couple minutes later and AC Milan playmaker Ronaldinho played in Neymar, but Romero dealt with the danger.
In the 18th minute, a shot by Dani Alves came back off the crossbar, after a good combination with David Luiz inside the box.
Two minutes later Benfica central defender Luiz headed wide.
Ronaldinho continued to threaten, and a free-kick by Robinho forced Romero into another save.
Argentina had only a couple of long-distance shots, one by Javier Zanetti and one by Messi.
Brazil began the second half brightly and a couple of free-kicks from Ronaldinho threatened to bring about the game’s opening goal.
Argentina slowly improved, and Lavezzi’s introduction off the bench in place of Gonzalo Higuain improved their attack, with the substitute causing trouble down the right.
Ronaldinho and Neymar were substituted with 15 minutes remaining, with a goalless stalemate apparently looming.
However Messi had other ideas and with the 90 minutes up he played a sharp one-two with Lavezzi before surging forward from midfield, snaking through the Brazil defence before planting his shot clinically into the net.