Javier Hernandez scored from the penalty spot shortly after Andrea Pirlo had curled in a free kick, leaving Mexico and Italy even at 1-1 at halftime on Sunday in Group A of the Confederations Cup.
Hernandez converted from the spot in the 34th minute, shortly after Giovani Dos Santos was brought down by Andrea Barzagli.
Italy striker Mario Balotelli, who had several chances of his own, was earlier knocked down by a pair of Mexican players to set up Pirlo's free kick. Making his 100th international appearance in the first competitive match at the renovated Maracana Stadium, the Italy midfielder stepped up and sent his shot over the wall and into the top left corner.
Brazil beat Japan 3-0 on Saturday in the other group match.