Mario Balotelli and Philippe Mexes scored late on at Siena as Milan came from behind to secure a place in the UEFA Champions League.
Balotelli’s 84th-minute penalty had cancelled out Claudio Terzi’s first-half header, before Mexes netted a crucial winner three minutes from time.
A hard-fought second half saw both sides reduced to 10 men in the space of just a few minutes after Massimo Ambrosini and Christian Terlizzi were both sent off for second bookable offences.
But it was the late goals that made all the headlines as Milan guaranteed their place at European football's top table in dramatic circumstances.
Milan came into the game needing to win in order to beat Fiorentina to the final UEFA Champions League place, and they made five changes to the team that played out a controversial 0-0 draw with Roma last week.
Sulley Muntari's bizarre red card in that game meant that he was suspended, while Ignazio Abate was preferred ahead of Kevin Constant.
Robinho, Antonio Nocerino, Riccardo Montolivo and M'Baye Niang were all handed starts.
Siena, whose relegation was confirmed with a 2-1 loss away to Napoli, welcomed back Alessandro Rosina.
Milan began the game with an expected level of urgency, creating a flurry of chances during the opening exchanges.
Balotelli was the first to test Gianluca Pegolo in the Siena goal, seeing his stinging long-range effort tipped over the crossbar.
A few moments later, Cristian Zapata saw a header cleared off the line before Brazilian Robinho was unlucky not to break the deadlock when he saw his vicious swerving shot palmed away by Pegolo.
And Milan were made to pay for their profligacy just before the half-hour mark when the hosts took an unlikely lead through Terzi.
A pinpoint free-kick from Rosina found the head of the defender, who took advantage of some slack Milan marking to direct his header past Chrisitan Abbiati.
Milan nearly conjured up the perfect response just two minutes later, when Balotelli crashed a shot onto the crossbar.
And the Italian was involved again just before half-time, forcing a decent save from Pegolo as Siena weathered the Milan storm.
The second half began in similarly frustrating circumstances for Milan, as they struggled to find a decisive final ball. And 10 minutes later they were down to 10 men when Ambrosini slid in rashly on Adrian Callelo and was shown a second yellow card.
The numbers were even soon after, though, as the home side were also down to 10 men - Terlizzi given his marching orders for jumping into a challenge with Balotelli.
Balotelli made his mark in some style 10 minutes from time when he was brought down in the box by Felipe to give Milan hope.
The Italian brushed himself down to calmly slot home the resulting spot-kick and the comeback was on.
Then, with just two minutes to go, Mexes found himself on the end of a Montolivo cross to slot home the dramatic winner.
|88||C. Terlizzi||45' 70'|
|14||F. Della Rocca|
|Coach: G. Iachini|
for A. Rosina 61'
for I. Emeghara 75'
for M. Rubin 89'
|Goalless Muller was the best player, says Ancelotti after thrashing|
|Phil Neville backs Rashford to match Griezmann|
|Juventus 2 Empoli 0: Champions cruise to 10-point gap at summit|
|Howe refusing to panic as Bournemouth´s struggles continue|
|Zarate was making the difference before injury - Mazzarri|
|I owe him my eternal gratitude - Vardy´s emotional Ranieri tribute|
|Cantona: Ibrahimovic is like me|
|Watford 1 West Ham 1: Ayew halts injury-hit hosts|
|Napoli 0 Atalanta 2: Caldara double stuns Sarri´s men|
|Ancelotti: It was a perfect day|
|Championship review: Newcastle drop points, Leeds clip Owls´ wings|
|Allardyce hails Van Aanholt and Sakho|
|Koeman lays into ´lucky´ Everton´s second-half display|
|Conte: We still need 29 points for Premier League title|
|We need an Aubameyang who does not think too much - Tuchel|
|Guingamp 1 Monaco 2: Glik, Fabinho on target|
|Marco Silva blames lack of focus as Hull remain in drop zone|
|Lukaku becomes Everton´s joint leading Premier League scorer|
|Real Betis 1 Sevilla 2: Sampaoli´s men heap pressure on Real Madrid|
|RB Leipzig 3 Cologne 1: Hosts capitalise on errors to stay hot on Bayern´s heels|
|Hull City 1 Burnley 1: Keane on target as 10-man Clarets end dire away run|
|Chelsea 3 Swansea City 1: Fabianski´s error helps Premier League leaders move 11 points clear|
|Neuer reaches 100 Bundesliga clean sheets for Bayern in record-breaking fashion|
|Everton 2 Sunderland 0: Unhappy Goodison return for Moyes as Lukaku wraps it up|
|West Brom 2 Bournemouth 1: McAuley winner piles pressure on Howe|
|Crystal Palace 1 Middlesbrough 0: Van Aanholt proves difference in nervy basement battle|
|Luis Enrique dismisses claims of dressing room discontent at Barcelona|
|Bayern Munich 8 Hamburg 0: Lewandowski hits hat-trick in special day for Ancelotti|
|Freiburg 0 Borussia Dortmund 3: Aubameyang back in the goals with a brace|
|#Piegate bites back as Sutton are forced to use outfield player in goal|
|Schmeichel denies players met with Leicester board to get Ranieri sacked|
|Spalletti would not swap Dzeko for Icardi|
|Emery understands Marseille rivalry and hopes PSG can repeat Barca win|
|Ibrahimovic better than ever and could play on until he turns 40 - Mourinho|
|Simeone: Barcelona still the best team in the world|
|A-League Review: Victory stay in Sydney hunt, Roar slip up at home|
|Zidane hopes potential France return will boost Benzema|
|I have not talked to anyone at Leicester - Mancini on replacing Ranieri|
|LaLiga teams raise their game against Real Madrid, claims Zidane|
|Arrivederci, Claudio! Ranieri says his final Leicester goodbyes|
|Soldado expects Real Madrid to come out fighting after Valencia loss|
|Montella hoping to remain AC Milan coach despite impending takeover|
|Valencia hopes EFL Cup triumph can inspire late title charge|
|Pele´s son vows to clear his name after being jailed for money laundering|
|Wijnaldum highlights Kante loss as crucial to Leicester´s downfall|
|Lyon rejected chance to sign Sakho, says Aulas|
|Koeman hopes Southampton lose EFL Cup final to boost Everton´s European hopes|
|Mata insists Manchester United will not take EFL Cup final for granted|
|Simeone´s Atletico starting to decline, Abbiati claims|
|Chelsea´s Fabregas ´100 per cent´ staying at Stamford Bridge|
|´Being Joey´ - Dyche talks up Barton TV show|
|Messi the best of all time, says Jovetic|
|You can define an era - Buffon wishes Donnarumma happy birthday|
|Clement: Llorente wants to star against Chelsea|
|Koeman not interested in Everton renewal amid Barca links|
|Rivals scared of Ibrahimovic, says United team-mate Herrera|
|Schmeichel pays tribute to Ranieri|
|Yaya Toure wants to play with Neymar and Coutinho|
|Mourinho: It´s more difficult to win now|
|I didn´t sleep for six days – Conte motivated by last-gasp title loss|
|It all depends on success - Klopp knows trophies are a must|
|Barkley targets finishing above Liverpool|
|Championship Review: Birmingham ease pressure on Zola with derby win|
|Mourinho could start Rooney in EFL Cup final|
|Comeback kid Le Bihan moves Nice level with Monaco|
|Leicester job an amazing opportunity - Rowett pitches to replace Ranieri|
|Deschamps free to pick Benzema, Le Graet reveals|
|Valencia request new time for Barcelona fixture|
|Rabona-fide brilliance! Watch Kovacic´s marvellous strike in Real Madrid training|
|Hull´s Silva cools Hernandez CSL rumours|
|Frustrated Allardyce accepts Palace players are struggling|
|Sampaoli tells Sevilla to learn from Real Madrid errors in ´most important game of the year´|
|Raiola ready to cut off Balotelli´s tongue after latest red card|
|My dream died after Leicester sack - Ranieri|
|Schalke sign Bentaleb from Tottenham|
|Puel welcomes Mkhitaryan´s EFL Cup final absence|
|Arsenal chairman concedes Gunners are playing for pride against Bayern|
|Melbourne City 1 Sydney FC 3: Bobo double helps leaders back to winning ways|
|Kohler refuses to write off Gotze|
|Ranieri will be remembered in 2,000 years, says Mancini|
|You don´t owe anyone - Henry tells Rooney to make China move if it makes him happy|
|I was not an Italian spy! - No ulterior motive for Conte in Eddie Jones meeting|
|Inter coach Pioli expects tight Roma clash|
|Mourinho: Leicester should name stadium after Ranieri|
|Conte: Ancelotti the best Italian coach in the world|
|Carrick in, Mkhitaryan out for Manchester United in EFL Cup final|
|Klopp compares Ranieri sacking to Trump, Brexit triumphs|
|Ranieri did not lose Leicester dressing room, insists Shakespeare|
|Conte willing to risk sack to lead Chelsea to Premier League glory|
|Disapponting for managers around the world - Premier League bosses react to Ranieri sacking|
|Ribery ready for Bayern Munich comeback|
|Celtic fined for Manchester City crowd trouble|
|Vardy´s goal decline and Mahrez´s assist struggles: The Opta stats behind Ranieri´s Leicester demise|
|Bayern boss Ancelotti vows never to repeat middle finger gesture|
|Medel urges Sanchez to quit Arsenal for Inter|
|Europa League draw: Manchester United to play Rostov, Lyon v Roma|
|Aubameyang dry spell worries me - Tuchel|
|Varane a doubt for Napoli as Real Madrid confirm muscle injury|
|Leicester job favourite Mancini: I am sorry for my friend Ranieri|
|Allegri welcomes back Bonucci following apology|
|Montella targets lengthy AC Milan stay|
|Lineker cries after Ranieri is sacked|
|Ranieri sacking ´the biggest shock in a decade´|
|Wenger ´witch-hunt´ has gone too far, says Bilic|
|Lewandowski better than Benzema, Suarez, Costa - Matthaus|
|Sticks and Stones may break my bones - Man City defender unhurt by criticism|
|Atletico Madrid v Barcelona: Simeone´s men primed to land on punch-drunk Barca|
|Pogba no machine like Messi or Ronaldo, says Mata|
|Oxlade-Chamberlain adamant Arsenal ´more than capable of competing for title´|
|Monaco star Falcao was almost lost to baseball|
|FC Dallas 4 Arabe Unido 0: Champions League semis beckon for Americans|
|No gratitude in football - Spalletti saddened by Ranieri sacking|
|Alli not to blame for Tottenham´s Europa League exit - Pochettino|
|Mourinho pays tribute to axed Leicester boss Ranieri|
|Europa League Review: Spurs crash out, Stindl stuns Fiorentina, Lyon destroy AZ in record-equalling|
|Bastia punished over Balotelli abuse|
|Eriksen blames Tottenham´s shock Europa League exit on poor finishing|