Atalanta grabbed a stoppage-time equaliser in this very ill-tempered affair, meaning Milan are in the Europa League, but not yet sure of sixth.
This was a showdown for sixth place, which would mean Europa League access without going through the preliminary rounds from July. Andrea Conti and Cristian Zapata missed out for the visitors, but Lucas Biglia returned just a few weeks after a fracture in his back that many feared would rule him out of the World Cup. Andrea Petagna, Leonardo Spinazzola and Luca Rizzo were injured, so teenage striker Musa Barrow again started for the Orobici.
Atalanta Coach Gian Piero Gasperini was in the stands after his red card for dissent, but had a big grin on his face as he saw the ultras unfurl a giant banner depicting him.
Rafael Toloi needed two risky defensive headers to stop dangerous Hakan Calhanoglu free kicks wreaking havoc for Etrit Berisha.
The heavens opened with a thunderstorm that made it difficult for the two teams to play.
There were chaotic scenes in the box on 40 minutes, as Atalanta had three shots in the same move charged down with desperate defending to deny Bryan Cristante twice and Remo Freuler.
Etrit Berisha found the conditions difficult, as he fumbled a Suso free kick. Atalanta somehow failed to score when Donnarumma performed a remarkable reaction save on Cristante’s header, then Mattia Caldara shinned the rebound wide from a couple of yards.
Cristante’s curler was also off target, but just as Atalanta were pinning Milan back, Franck Kessie broke the deadlock against the run of play.
Kessie’s back-heel flick on the edge of the area started the move, but when a clearance from Kalinic came back to the Ivorian, he smacked a daisy-cutter into the far bottom corner. The young midfielder refused to celebrate against his old club.
Atalanta then shot themselves in the foot, as Rafael Toloi was booked for a foul and immediately sent off for sarcastically applauding the referee’s decision.
They still threatened an equaliser, as Gomez sprinted down the left and his cross-shot was parried by Donnarumma only for Cristante to fire the rebound wide.
The temperature rose even further in an increasingly tense match when Riccardo Montolivo received a straight red for his two-footed very clumsy tackle on Gomez, leaving both teams down to 10 men.
It was an extremely ill-tempered affair with 11 yellow cards and two red. Robin Gosens flashed a volley across the face of goal, then Gomez’s cross-shot went past everyone.
Deep into stoppages, Ilicic’s cross found Andrea Masiello at the back post and Donnarumma wasn’t strong enough in the save to keep out the header, giving Atalanta a dramatic equaliser.
See the latest Serie A predictions and betting tips with Eurotips.co.uk
Sent off: Toloi 64 (A), Montolivo 75 (M)