Atalanta qualified for the Champions League for the first time on a dramatic final day of the Serie A season.
The Bergamo side, in their 112th year, Inter Milan, AC Milan and Roma all went into the final round of fixtures in contention for the final two spots.
However, it was Atalanta and Inter, in third and fourth at the start of the day, who took the places.
Atalanta recorded an easy home win over Sassuolo and Inter triumphed 2-1 over Empoli, who were relegated.
Coach Gian Piero Gasperini's Atalanta had in the previous two seasons flirted with the Champions League spots having previously finished in mid-table positions since their last promotion from Serie B in the 2010-11 season.
The club, with a modest budget, finished seventh in 2017-18 and fourth in the previous campaign, however only three Champions League spots were awarded to Italian sides back then.
The rules changed for this campaign and Atalanta took full advantage. Colombian Duvan Zapata, who finished as the club's top scorer this season with 23 goals, netted first in Sunday's match before forward Papu Gomez and midfielder Mario Pasalic, on loan from Chelsea, added the other two. The 77 goals they scored were the most of any side in the league.
Atalanta finished with 69 points, ahead of Inter on head-to-heads. Their coach Luciano Spalletti is set to be replaced by former Chelsea boss Antonio Conte, and at times it seemed as if he would fail in his mission to leave the Nerazzurri with the parting gift of a Champions League spot.
They were well and truly out of the running when AC Milan went 2-0 up inside 23 minutes. Keita Balde's low drive in the second half put the issue back in their control before Empoli levelled with 14 minutes left to leave Inter in fifth spot, as it stood.
However, five minutes later Radja Nainggolan fired in after Matias Vecino's strike came off the post to relieve the tension. Empoli substitute Salih Ucan came close to denying Inter late on and saving his own club from the drop, but the home side hung on for victory.
AC ended their campaign in fifth with a 3-2 win at SPAL and Roma defeated Parma to take sixth place. They will both play in next season's Europa League.