EAST RUTHERFORD, N.J. — Lionel Messi scored on three dazzling runs for his second international hat trick, finishing the season with a record 82 goals for club and country and giving Argentina to a 4-3 win over South American rival Brazil in an exhibition game Saturday.

With Brazil using a mostly young roster ahead of the Olympics, Romulo put the five-time world champions ahead in the 23rd minute. Messi gave Argentina a 2-1 lead with goals in the 31st and 34th on spectacular dashes that beat the defense, but Oscar tied the score in the 56th and Hulk tapped in a corner kick dropped by goalkeeper Sergio Romero in the 72nd.

Argentina came back once again three minutes later when Frederico Fernandez scored off a corner kick by Sergio Aguero, who had just entered the game.