Barcelona were shocked 3-1 by Real Sociedad to slip behind in the La Liga title race, while Real Madrid beat Elche 3-0.
Alex Song's own goal was cancelled out in the 36th minute by Lionel Messi, who slotted the Catalans level before the break. However, as Barca coach Tata Martino was sent off during half-time, Socieded came out of the blocks quickly in the second half and struck twice in five minutes through Antoine Griezmann and David Zurutuza.
Barcelona huffed and puffed but were lucky not to concede another as they slipped up and fell three points behind their rivals.
Gareth Bale scored an outstanding long-range goal as Real Madrid beat Elche 3-0 at the Bernabeu to go top of the table.
The world's most expensive player added to Asier Illaramendi's first-half opener with a stunning strike on 71 minutes, and then substitute Isco hit a third with 10 minutes remaining.
In the absence of the suspended Luka Modric, Madrid struggled to control the game in the opening half an hour but, although Madrid never hit top gear, they pulled off their 10th home win of the season and took advantage of Barcelona's slip to stay top.
Getafe remain in trouble near the bottom after drawing 1-1 at Celta Vigo, but did well to pick up a point after playing the majority of the second half with 10 men.
Angel Lafita gave Luis Garcia's side the lead after 20 minutes but Getafe failed to cling onto their advantage and made things easier for Celta when Lisandro Lopez was shown a second yellow card early in the second half, shortly after which Rafinha equalised.
The point means Getafe are still four points from the relegation zone while Celta remain in 10th.
Relegation rivals Almeria and Malaga shared a goalless draw at the Juegos Mediterraneos on Saturday night.
Neither side did enough to warrant victory as they instead claimed a point each to edge them away from the relegation places.
Almeria finished the night slightly better off, four points above the bottom three, with Malaga a place and a point behind in 17th.