Spezia and Hellas Verona face a relegation play-off following a dramatic final day of the Serie A season.
The two sides started the day level on points and could not be separated after both suffered defeats away from home.
Dimitris Nikolaou gave Spezia the lead against Europa League runners-up Roma after just six minutes, but Nicola Zalewski equalised just before half-time and Paulo Dybala held his nerve to convert a 90th-minute penalty.
The spot-kick was awarded after Kelvin Amian fouled Stephan El Shaarawy, with Amian sent off for a second bookable offence.
Verona were on course for the point against AC Milan which would have been enough for safety when Davide Faraoni’s 72nd-minute goal cancelled out Olivier Giroud’s penalty, but Rafael Leao scored twice in the closing minutes to give the Rossoneri a 3-1 win.
After the match, Milan striker Zlatan Ibrahimovic announced his retirement from football at the age of 41.
The first relegation play-off since Bologna faced Parma in 2005 will take place at a neutral venue next weekend.
At the other end of the table, Atalanta thrashed 10-man Monza 5-2 to secure a Europa League place along with Roma, with Juventus set for the Europa Conference League despite a 1-0 win at Udinese.
Champions Napoli ended the season with a 2-0 win over bottom side Sampdoria, Victor Osimhen scoring his 26th goal of the season from the penalty spot after being fouled in the area and Giovanni Simeone rifling home from distance five minutes from time.
A potentially dramatic battle in LaLiga failed to produce any real fireworks as Real Valladolid were relegated following a 0-0 home draw with Getafe.
Six teams were in danger of joining the already-relegated Espanyol and Elche in going down, but Valladolid started and ended the day in the bottom three following a disappointing stalemate.
Celta Vigo made certain of survival with a 2-1 win over champions Barcelona thanks to a brace from Gabri Veiga.
Barcelona ended the season 10 points clear of runners-up Real Madrid after Karim Benzema marked his final appearance for the capital club with the equaliser in a 1-1 draw with Athletic Bilbao.
Benzema scored a 72nd-minute penalty to cancel out Oihan Sancet’s opener early in the second half.
In Belgium, Toby Alderweireld fired in a stunning last-gasp goal to help Royal Antwerp win their first league title since 1957.
The former Tottenham defender – who joined his hometown club last summer – equalised in the fourth minute of stoppage time from outside the box as Antwerp rescued a 2-2 draw against title rivals Genk.
The goal meant Antwerp edged out both Genk and Union Saint-Gilloise by just one point to win the Belgian league title for only the fifth time in their history.