The 39-year-old had missed four games and not played for almost a month after contracting COVID-19, but he put Stefano Pioli’s men two goals up inside 16 minutes on Saturday.
Romelu Lukaku got Inter back in it before the break but, despite second-half pressure, Antonio Conte’s side could not force an equaliser as their four-match derby winning streak was ended.
Milan stunned Inter with two goals in the space of three minutes, both scored by Ibrahimovic.
After being sent through on goal by Hakan Calhanoglu, the Swede drew a clumsy foul from Aleksandar Kolarov and took the resulting penalty himself.
Samir Handanovic dived to his right to make an impressive save, only for Ibrahimovic to convert a left-footed rebound.
Ibrahimovic then struck again after a superb counter-attack that also involved Calhanoglu resulted in Rafael Leao sending in a superb cross from the left, which he impressively converted with a controlled first-time finish.
Lukaku made no mistake in the 29th minute as he tucked in from close range after Gianluigi Donnarumma inadvertently touched Ivan Perisic’s driven cross into his path.