Sergio Gonzalez (R) scored the winner for Leganes to upset La Liga leaders Barcelona. (AP PHOTO)
Sergio Gonzalez (R) scored the winner for Leganes to upset La Liga leaders Barcelona. (AP PHOTO) Credit: AAP
Barcelona have stayed top of the Spanish league despite a shock 1-0 home defeat to lowly Leganes, a team without an away win all season.
Leganes went ahead with Sergio González's header after four minutes and spent most of the match defending their lead.
Keeper Marko Dmitrović was superb, especially in the first half, and Barcelona's front players were so ineffectual that coach Hansi Flick withdrew Robert Lewandowski, Dani Olmo and Lamine Yamal in the final minutes.
His changes, however, had little effect and Leganes, promoted from the second tier in May, celebrated a win that lifts them into 15th, four points clear of the relegation zone.
"Taking the lead so early against teams like this is dangerous because they have so much potential," said Leganes defender Jorge Saenz.
"We were able to defend together and keep them away from our area. Dmitrovic made three saves that were life-saving for us."
"It's only three points, but for us they're like gold. Things were getting tight and this gives us a little breathing room."
In other games, Atletico Madrid beat Getafe 1-0 to leapfrog city rival Real Madrid and go second.
Both Barcelona and Atletico have 38 points but Barcelona have a better goal difference.
Playing in the first of five La Liga matches on Sunday, Atletico won their sixth consecutive league game to move a point clear of Real, following their 3-3 draw with Real Vallecano on Saturday.
Visitors Getafe had taken just two points from their seven away games so far this season but it made life difficult for Diego Simeone's side.
It took Atletico until the 70th minute to get the winner from Alexander Sorloth's header.
Meanwhile, the Basque derby ended all square with Alaves and Athletic Bilbao sharing the points in a 1-1 draw that snapped Atheltic's six-game winning streak.
Alaves was on the defensive for much of the match and went behind after 10 minutes when Unai Gómez hit the net after taking a nice pass from Iñaki Williams.
But Joan Jordán took advantage of a goalkeeping error midway through the second half to level the scores.
Real Betis stretched an unbeaten run to four games with a 2-1 win at Villarreal but coach Manuel Pellegrini was angry at playing with 10 men for most of the game after Ezequiel Ávila was given a red card.
The Argentine forward was sent off for a cynical foul 11 minutes before halftime with Betis 1-0 up thanks to a goal from on-loan Barcelona striker Vitor Roque.
Giovani Lo Celso made it 2-0 a minute after the break with a superb free kick before Alex Baena got one back with a superbly taken volley.
Pellegrini was angered that Ávila's foul was not reviewed by the video officials.
"Penalties, red cards, they should always be reviewed," Pellegrini said.
[## Get the latest news from thewest.com.au in your inbox.
Sign up for our emails](https://thewest.com.au/manage-email-preferences)