Atalanta won at Sassuolo on Sunday to secure their first ever UEFA Champions League spot and Inter Milan joined them while ensuring Empoli were relegated after a frantic second half in the San Siro. AC Milan ended up fifth despite winning at SPAL. Genoa and Fiorentina stayed in Serie A after a nerve-wracked goalless draw. The evening started with Inter, Atalanta, AC Milan and Roma battling for the two remaining Champions League spots and Empoli knowing that if they won they would survive. Because their ground is being redeveloped, Atalanta had to cede home advantage and play at Sassuolo where they quickly fell behind.
Duvan Zapata levelled before half-time. After Sassuolo lost their scorer Domenico Berardi, who received a red card for his part in the mass brawl that ended the first half, Atalanta comfortably sealed third as goals by Alejandro Gomez and Mario Pasalic completed a 3-1 win.
"It's been an extraordinary season," Atalanta president Antonio Percassi told Sky Sport.
"My first hug was for (coach Gian Piero) Gasperini, for a lifetime. It's already a given that he'll still be here next season."
Milan took a two-goal lead at SPAL, with goals by Hakan Calhanoglu and Franck Kessie, but Francesco Vicari and Mohamed Fares replied.
Meanwhile at the San Siro, after a goal-less first half, Inter brought on Keita Balde. The striker broke the deadlock with a solo goal six minutes later, earning a yellow card for ripping off his shirt in celebration.
The home team had a chance to increase their lead when Mauro Icardi tumbled over Empoli goalkeeper Bartlomiej Dragowski. After a delay for video review, Icardi missed the penalty.
A few minutes later in Ferrara, Kessie rolled in a penalty to put AC Milan back in the lead against SPAL. They held on to win 3-2.
Back at the San Siro, Salih Ucan's low cross from the right reached Hamed Traore unmarked in front of goal and he levelled to lift Empoli out of the relegation places and push Inter out of the top four.
Five minutes later, Radja Nainggolan changed that when he pounced on a rebound to put Inter ahead.
In a frantic finish, Empoli came close several times with Inter centre-back Stefan de Vrij deflecting one shot onto his own bar.
In added time, with Dragowski in the Empoli attack, Inter rolled the ball into the empty net, but Balde had pulled Dragowski back in the build-up. The goal was disallowed and Balde earned a second yellow card.
Yet the 2-1 win was enough to save Inter and doom Empoli.
De Rossi says goodbye
The wins of the three teams above them meant Roma finished sixth despite beating visiting Parma 2-1. They also bid farewell to captain and local hero Daniele De Rossi who came off to rapturous applause with nine minutes to play.
Earlier on Sunday, Massimiliano Allegri ended his Juventus career in disappointing fashion as the champions were undone by two late strikes at Sampdoria to finish the Serie A season with a five-match winless streak.
Despite a poor final few weeks they still finished 11 points ahead of second-placed Napoli, who ended their underwhelming campaign beaten 3-2 at Bologna on Saturday.
"I feel good because I ended five incredible years by winning the title ... tomorrow a new era begins," Allegri told broadcaster DAZN after the 2-0 defeat.
He leaves having also won four Italian Cups and re-established the Old Lady as a force in Europe, reaching two Champions League finals and signing Cristiano Ronaldo last summer.
"I'll come back to work when I have the opportunity ... I need to find a team with which I can enjoy myself and do a good job," he added.
Sampdoria's 36-year-old striker Fabio Quagliarella failed to add to his 26 goals but still finished as the Serie A top scorer, three ahead of Zapata.
Torino finished their exciting campaign in seventh place, level on points with Roma, following a 3-1 win over Lazio.