The Brazilian attacker came off the bench with 15 minutes to go but gave the Nerazzurri the lead to ensure they stay in the European spots in Serie A.
The Brazilian attacker came off the bench with 15 minutes to go but gave the Nerazzurri the lead to ensure they stay in the European spots in Serie A.
The 29-year-old struck either side of half-time as the Old Lady triumph on Massimiliano Allegri's 100th Serie A game in charge.
The Bianconeri extended their lead over Roma in Serie A to four points and have a game in hand over the second-place side.
The hosts had the game under control with a two-goal advantage, but lost their focus and were forced into extra time before the midfielder hit home.
The Italian champions are now seven points ahead of second-place Roma following their win over struggling Crotone on Wednesday.
The defending cup holders were not unduly troubled by the Rossoneri - who were reduced to 10 men - after they sealed victory in the first half.
Sergio Pellissier opened the scoring at the San Siro, but the hosts made it five wins in a row through Mauro Icardi, Ivan Perisic and Eder.
The Colombia international scored the only goal of a tense clash to restore the Bianconeri's imposing lead at the Serie A summit.
Massimiliano Allegri's men recovered from their recent defeat to Fiorentina to ensure they stay well ahead of Roma and Napoli with a game to spare.
Mario Mandzukic and Paulo Dybala misses proved costly as the resurgent San Siro side lifted their first piece of silverware under Vincenzo Montella.