Striker Portu scored twice as Girona fought back to beat Barcelona 4-2 and hand Real Madrid the LaLiga title.
Barca ran out at the Estadio Municipal de Montilivi knowing anything other than victory would leave them unable to catch the leaders, who had earlier eased to a 3-0 win over lowly Cadiz.
In the event, they led 1-0 and 2-1 as Andreas Christensen and Roberto Lewandowski from the penalty spot struck either side of Artem Dovbyk’s fourth-minute equaliser.
However, Portu levelled 20 minutes into the second half and, after Miguel Gutierrez had put the home side ahead, sealed a win which sparked celebrations in Madrid and lifted his side above the Catalans into second place.
Earlier, Jude Bellingham scored two minutes after coming off the bench to help ease the leaders to victory over relegation-haunted Cadiz.
It was goalless at half-time at the Bernabeu, but Brahim Diaz broke the deadlock six minutes after the restart and England international Bellingham, a 66th-minute replacement for Arda Guler, made it 2-0 with his 22nd goal of the season before Joselu wrapped up the win deep into injury time.
Defeat left Cadiz five points shy of safety with four games remaining.