Italy moved level with Brazil at the top of Confederations Cup Group A after a tough win over Mexico at the Maracana.
Andrea Pirlo, playing his 100th game for his country, put Italy ahead in the first half with a stunning free-kick before Javier Hernandez levelled from the spot.
Mario Balotelli put the Italians ahead again with 12 minutes left to seal a deserved victory.
Mexico came into the match on the back of eight draws from their last nine matches and for a large period they looked set to continue that trend, thanks in the main to goalkeeper Jose de Jesus Corona.
Italy dominated the majority of the match but the Mexican stopper was in impressive form to keep them at bay, with Balotelli in particular frustrated until his late winner.
The Azzurri began strongly and seven minutes in Riccardo Montolivo broke down the left and although Balotelli made good contact from his cross, the striker's effort was deflected away by the goalkeeper.
The AC Milan striker had another effort moments later, his 20-yard effort bouncing awkwardly in front of the goalkeeper who did well to divert the ball away.
Moments later Mexico created their first opportunity, Giovani Dos Santos outmuscling Ignazio Abate and pulling the ball back to wide man Andres Guardado, whose powerful effort hit the bar.
Pirlo went down in the area under pressure from Guardado but his appeals were ignored by referee Enrique Osses.
If the Juventus man felt aggrieved by the decision, he put his frustrations to one side after 27 minutes when his curling 25-yard free-kick flew into the top corner.
Pirlo was running the match from the middle of the park and played a wonderful ball into Emanuele Giaccherini who failed to make the most of the chance.
However Mexico were looking dangerous themselves and after 34 minutes Dos Santos caught Andrea Barzagli on the ball before he was brought down by the defender in the box.
Hernandez sent Gianluigi Buffon the wrong way to level the scores with his 33rd international goal.
Balotelli was denied by Corona six minutes before the break before a wonderful first-time ball from Pirlo found Abate but his probing cross was pushed away by the goalkeeper.
Pirlo created another opportunity seven minutes into the second half, albeit inadvertently. His low free-kick was directed off the wall into the path off Giorgio Chiellini, who struggled to get the ball out of his feet and get a decent shot on target.
Pirlo fizzed a free-kick wide after 58 minutes, before Hector Moreno hauled down Balotelli just outside the box when the Italian was through on goal, with the referee unimpressed by the striker's protests, which included him throwing his boot in frustration.
Despite having decent periods of possession, Mexico struggled to create opportunities although Buffon should have been tested by Gerardo Flores but his free header from a free-kick went wide.
Italy's pressure finally told in the 78th minute when Balotelli proved too strong for Rodriguez as they challenged for a high ball before firing an unstoppable shot past Corona.
Substitute Raul Jimenez surged forward in the 88th minute before forcing a diving save from Buffon in what was a rare foray forward.
The result means Mexico will almost certainly have to register a positive result when they face tournament hosts Brazil on Wednesday, while a win for Italy against Japan should see them progress.