Cagliari were relegated from Serie A after only managing a draw against Venezia as Salernitana retained their top-flight status despite being thrashed by Udinese.
Salernitana looked in serious danger of going down when Davide Nicola took charge in February, sitting bottom of the table with three wins from 23 games.
Nicola inspired a resurgence, though, with his side picking up 15 points in a run of seven league games to head into the final matchday two points clear of Cagliari.
However, Udinese were rampant as Gerard Deulofeu, Ilija Nestorovski and Iyenoma Destiny Udogie put Nicola's side 3-0 down before half-time on Sunday.
Udinese captain Roberto Pereyra added a fourth after the interval as the Friulians achieved their best Serie A points haul (47) since the 2012-13 season (66).
That meant Cagliari would have stayed up with a win at already-relegated Venezia, but Alessandro Agostini's could only muster a draw as the Rossoblu were relegated to Serie B for the sixth time in their history.
Cagliari's failure handed Salernitana their first-ever Serie A survival, having failed to do so on their other two attempts in 1947-48 and 1998-99.
Salernitana also became the first team to stay up despite conceding at least 78 goals in a single top-flight campaign after Livorno (79 in 1929-30) and Lucchese (82 in 1947-48, 79 in 1949-50).
Meanwhile, Cagliari join Venezia and Genoa in Serie B and the trio will aim to bounce straight back up next season.