Granada was relegated from the Spanish league after missing a second-half penalty kick which could have kept the team up, with Cádiz taking advantage to stay in the first division. (More Football News)
Striker Jorge Molina missed a 72nd-minute penalty in Granada's 0-0 draw against Espanyol, when a win would have been enough for the hosts regardless of other results. The setback opened the door for Cádiz, which won with a goal from Anthony Lozano a few minutes after the missed penalty in Granada to stay in the top flight.
Cádiz, Granada and Mallorca entered the last round fighting to avoid demotion, with Cádiz sitting inside the relegation zone before the matches started. Levante and Alavés had already been relegated.
Mallorca secured its place in the top tier after a 2-0 win at midtable Osasuna, with Ángel Luis Rodriguez and Clément Grenier scoring second-half goals.
Mallorca and Cádiz ended with 39 points, one more than Granada.
After sending his low penalty shot just wide by the left post, Molina raised his hands to cover his face in despair. He was emotional after the match as players and coaches from both teams came to console him.
Granada had a few late chances but could not capitalize on them. It will be playing in the second division for the third time in 12 seasons. The southern Spanish club had been in the top tier since 2011-12, with the exception of consecutive stints in the second division from 2017-19.
Cádiz, also based in southern Spain, will play in the top flight for a third consecutive season after 14 years in the lower divisions.
Cádiz's fans were still celebrating Granada's missed penalty when Lozano found the net from close range in the 76th for the goal that proved to be enough to stay up.
There was a late scare when the referee went to check a possible penalty kick for Alavés a few minutes from the end, but video review determined that the handball by a Cádiz defender was involuntary.
Mallorca was promoted this season after a year in the first division. Before that, it had been in the lower tiers for six consecutive seasons. Levante had played five straight seasons in the first division, while Alavés was in the top flight for six years in a row.
In a match with both teams safe from relegation, Elche beat Getafe 3-1 with Kike Pérez scoring twice for the hosts.
Real Madrid, which had already clinched a record-extending 35th league title, finished its league campaign with a 0-0 home draw against Real Betis on Friday in its final game before facing Liverpool in the Champions League final on Saturday in Paris.