Champions Real Madrid suffered an embarrassing defeat at La Liga first-timers Girona and are now eight points behind league leaders Barcelona.
Midfielder Portu back-heeled in the winner in the second half, four minutes after ex-Middlesbrough striker Cristhian Stuani’s equaliser.
On-loan Manchester City full-back Pablo Maffeo and Portu both struck the woodwork for the home side.
Isco had given Real a first-half lead by tapping in from close range.
The result leaves Zinedine Zidane’s side in third place after 10 games behind unbeaten Barca and Valencia, while Girona collected just their third victory of the season.
This is Catalan side Girona’s debut season in the top flight of Spanish football, having been founded in 1930, and Sunday saw a squad made up mainly of loan players and free signings claimed the biggest victory in their history.
On the back drop of Catalonia being stripped of its autonomy for declaring independence, a number of supporters held up flags inside the 13,500-capacity Montilivi Stadium in support of their region.
The hosts took the game to their much-vaunted opponents – the current Spanish and European champions – and were fully rewarded for doing so.
Maffeo’s cross-shot looped over goalkeeper Kiko Casilla and came off the post, as did Portu’s flicked header across goal.
Real’s world player of the year Cristiano Ronaldo was closely marked by former Middlesbrough centre-back Bernardo, but it was the Portuguese’s shot which goalkeeper Yassine Bounou parried for Isco’s opener.
Girona continued to go on the offensive in the second period and turned the game around in the space of four minutes.
Another former Boro player, Stuani, coolly tucked in the leveller, before Portu’s instinctive strike sealed a famous victory.
Source: BBC Sports