Andrea Pirlo's fantastic free kick on his 100th international cap was cancelled out by Javier Hernandez' penalty, and a draw seemed inevitable before the striker powered home
The Azzurri dominated large spells of the first half, and matters appeared to be going according to plan when Andrea Pirlo, on his 100th cap, curled in a breathtaking free kick to break the deadlock after 27 minutes.
But an horrendous mistake by Andrea Barzagli saw him concede a penalty seven minutes later, from which Javier Hernandez converted coolly to level the scores before the break.
Mario Balotelli would spare Italy's blushes 12 minutes from time though, powering through towards goal and finishing to secure all three points, and keep his side on pace with Group A leaders Brazil, who beat Japan on Saturday.
Ten out of the 11 members of Italy’s starting line-up were from Serie A giants Juventus or AC Milan, with Daniele De Rossi of Roma the only exception.
For Mexico, Giovani dos Santos and Javier Aquino returned to the XI after sitting out the 0-0 draw with Costa Rica, while Gerardo Torrado began in midfield for his 141st cap.
Italy controlled the initial exchanges, as Balotelli and Emanuele Giaccherini narrowly missed, before the former’s low drive forced a save out of Jose de Jesus Corona, who lapped up the rebound at the feet of the latter.
It seemed like only a matter of time before they took the lead, but Mexico fired a warning shot back in their direction when Dos Santos slipped in Andres Guardado at the top of the box, who rattled the bar with a ferocious effort.
With a quarter of an hour gone, Pirlo was then chopped to the turf inside the area after pressure from a pair of Mexico defenders, but the referee ignored the frantic Italy appeals for a penalty.
But Pirlo would soon get his revenge, and after Italy were awarded a free kick 25 yards from goal, the Azzurri centurion stepped up to bend the ball magnificently into the top corner.
Italy’s joy was short-lived, however, as hesitation from Barzagli allowed Dos Santos the chance to nip the ball off his toes, and the Mallorca man was promptly fouled inside the area by the defender in an attempt to cover his mistake.
And Hernandez made no mistake from 12 yards out, sending Gianluigi Buffon the wrong way with a low strike to the right corner.
Moments after the restart, Pirlo nearly caused more damage with another set piece from just outside the box, which was deflected into the path of Riccardo Montolivo, who could not beat Corona from a few yards out.
But despite the Milan midfielder’s irrepressible threat from any free kick within 40 yards of goal, the second half did not quite progress in the swashbuckling manner as the first.
With an hour gone, Italy were denied another penalty after Balotelli appeared to be pulled back inside the area by Hector Moreno, only for the referee to wave play on, much to the striker’s fury.
Mexico appeared to have abandoned all interest in attacking, and seemed content to sit deep and soak up the Italian pressure, which mostly manifested itself in little more than catching practice for Corona.
But on a rare foray forward, Dos Santos won a free kick near the corner flag, from which Guardado delivered into Gerardo Flores, who narrowly missed the target with his head.
The match seemed to be petering out to an inevitable draw, but in the 78th minute, with one show of strength, Balotelli turned past Francisco 'Maza' Rodriguez and drilled past Corona with aplomb.
Mexico rallied late on in the opposition half, but fell flat as Buffon was not called into action, and Cesare Prandelli's men closed out the game to seal an important victory.