With Rafael Leao having already scored for the hosts, the French left-back's solo run and finish sparked wild celebrations at a raucous San Siro.
Milan will win the Scudetto with a draw at Sassuolo next Sunday as they have the superior head-to-head record in matches against their city rivals this season.
A tense affair had seen Milan initially struggle to break down a well organised Atalanta side chasing a European place.
However, Junior Messias' second-half introduction as a substitute reaped immediate dividends.