Milan opened up a six-point gap to Inter with a narrow victory over Cagliari on Saturday night, capitalising on their city rivals' slip-up earlier in the day in the Serie A title race.
The Nerazzurri were held to a 1-1 draw by Fiorentina at San Siro with both goals coming within five minutes of each other.
After Nicolo Barella had lifted a gilt-edged chance over the bar, Arsenal loanee Lucas Torreira was the unlikely source of the opener five minutes after the break, popping up in the penalty area to side-foot a cutback into the back of the net - his second goal in as many games.
However, Inter were level just five minutes later when Ivan Perisic's deep cross was nodded in by attacking wing-back Denzel Dumfries at the far post. The hosts thought they had the opportunity to win the game from the spot when Martinez went down in the box under a clumsy-looking challenge, but the referee reversed his decision after consulting the pitch-side monitor.
A brilliant piece of defending denied Alexis Sanchez what seemed a certain winner, as his goal-bound strike was somehow deflected over.
The result provided Milan with the opportunity to open up a six-point gap to Inter when they faced Cagliari on Saturday night - and they capitalised in an entertaining match in Sardinia.
Franck Kessie smashed a shot onto the post early on but the Rossoneri would have to wait until the hour mark to take the lead. From Olivier Giroud's knockdown, midfielder Ismael Bennacer produced a wonderful low volley that flew into the bottom corner from the edge of the box.
The hosts squandered a huge opportunity when Joao Pedro missed from close range and Leonardo Pavoletti hit the crossbar in stoppage time, but Milan held on for a huge win.
Napoli defeated ten-man Udinese earlier on Saturday to stay second in Serie A, three points behind the Rossoneri. Seeking their first title since 2011, Milan are three points clear at the top, six clear of Inter in third, although the Nerazzurri have a game in hand.