Real Madrid were stunned by struggling Girona on Sunday, losing 2-1 at home to see Barcelona extend their lead at the top of the Spanish league standings.
Real Madrid were coming off a five-match winning streak in the league, but they weren't able to get past their relegation-threatened rival at Santiago Bernabeu Stadium, conceding twice in the second half after taking a 1-0 halftime lead.
Girona hadn't won in 13 matches in all competitions and was coming off six straight losses. The Catalan club hadn't won in the league since November and had entered the weekend one point from the relegation zone.
The surprise loss dropped Madrid to third place and left the team nine points behind Barcelona, which on Saturday edged Valladolid 1-0 with a penalty kick converted by Lionel Messi. The result at Camp Nou Stadium ended a three-game winless run for the Girona neighbour in all competitions.
Atletico Madrid returned to second place after defeating Rayo Vallecano 1-0 on Saturday to halt a two-game losing streak in the league.
Casemiro put Real Madrid ahead with a header in the 25th, and Girona evened the match with a penalty kick converted by Cristhian Stuani in the 65th. It moved ahead with a header by Portu in the 75th.
Madrid captain Sergio Ramos was sent off in 90th after receiving a second yellow card.
Madrid goalkeeper Thibaut Courtois joined the attack for a last-minute corner and had a chance with a header from near the penalty spot, but his attempt missed just wide.