Milan are well on course to retain their title and now have 63 points.
Pablo Osvaldo put Roma ahead on 44 minutes but talismanic Sweden striker Ibrahimovic levelled from the penalty spot on 53 minutes after Daniele De Rossi's handball.
Ibrahimovic then lobbed the goalkeeper and headed home from close range seven minutes from time as Milan perfectly warmed up for Wednesday's Champions League quarter-final first leg at home to Barcelona.
"We have got to stop saying that we're allowed a mistake, because unconsciously we may start toying with the idea that we actually can make a mistake, while instead we cannot," Milan captain Massimo Ambrosini said.
"We must not have this type of approach. This can make us think we can lose a match, and well, we cannot."
With nine games left this term, Roma remain sixth on 44 points in the final Europa League berth.
Udinese moved level on points with Lazio in third after a 1-1 draw at Palermo in the other Serie A match on Saturday.
Amid heavy rain at the Renzo Barbera and after a very cautious start by both sides, Fabrizio Miccoli gave the hosts the lead just after the half hour but Udinese hit back six minutes from time thanks to Gabriel Torje.
Roma's opener, when Osvaldo finished off De Rossi's effort, came largely out of the blue with Milan dominating possession.
The visitors could even have been 2-0 up early in the second half after Francesco Totti squandered two chances.
The game changed moments later when De Rossi's handball allowed Ibrahimovic to send his penalty into the centre of the goal.
The former Inter and Juve forward then took his league tally to 22 with a superb goal befitting his stature as Serie A's most lethal and flamboyant striker of the last 10 years.
Roma boss Luis Enrique was philosophical in defeat.
"I wasn't satisfied with the first half, because we can do a lot better in terms of ball possession especially," the former Barcelona midfielder said.
"Paradoxically, our ball possession greatly improved in the second half and AC Milan scored when we were having our best moment in the game. It happens and we were playing against the strongest team in Serie A right now."
Milan, who welcomed back Kevin-Prince Boateng from a layoff, lost defender Thiago Silva to injury 11 minutes in but it was the only negative on another successful day for the Rossoneri.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.