Match ends, Leganés 2, Barcelona 1.
Barcelona lost for the first time this season after bottom-of-the-table Leganes came from behind to pull off a sensational victory.
Philippe Coutinho had put Barca in front with a 20-yard volley but Nabil el Zhar and Oscar Rodriguez scored twice in just 68 seconds.
Barca boss Ernesto Valverde lost for just the second time in La Liga since taking charge in the summer of 2017.
Leganes had just one point from five games going into the match.
But they stunned their illustrious opponents after the break, with Gerard Pique at fault for their second goal.
The defender inadvertently passed to Oscar, who is on loan from Real Madrid and slotted home the winner from 12 yards.
Barca had looked comfortable at 1-0, with Lionel Messi hitting the woodwork but they were shell-shocked by the two quick-fire goals.
The visitors never really looked like equalising, except for one brief spell when Ivan Cuellar's double save denied Philippe Coutinho's curler and Ivan Rakitic's follow-up.
Barcelona stay top of the table after Real Madrid lost 3-0 to Sevilla later on Wednesday - the first time both sides have lost a La Liga game on the same day since 2015.
"It's not a result that can be explained," said Valverde - whose side won the domestic double last season. "We found it hard to create chances, and they shut up shop at the back.
"It's not an easy moment. We weren't expecting this. But we have another important game on Saturday [against Athletic Bilbao] in front of our fans. We have to pick ourselves up and we'll need everyone's help to do that."
Leganes, meanwhile, climb to 17th in the table with their first victory of the season.
- 2Moreno Fuertes
- 3BustinzaBooked at 49mins
- 10El ZharSubstituted forNyomat 86'minutesBooked at 88mins
- 23VesgaSubstituted forMerinoat 82'minutes
- 21PérezBooked at 40mins
- 27RodríguezSubstituted forGumbauat 74'minutes
- 26En-NesyriBooked at 90mins
- 1ter Stegen
- 23UmtitiBooked at 60mins
- 24VermaelenBooked at 64minsSubstituted forAlbaat 70'minutes
- 19El HaddadiSubstituted forSuárezat 61'minutes
- 11DembéléSubstituted forMalcomat 71'minutes
- 2Nélson Semedo
- Alberto Undiano Mallenco
- Shots on Target
Second Half ends, Leganés 2, Barcelona 1.
Corner, Barcelona. Conceded by Allan Nyom.
Youssef En-Nesyri (Leganés) is shown the yellow card for a bad foul.
Marc-André ter Stegen (Barcelona) wins a free kick in the defensive half.
Foul by Youssef En-Nesyri (Leganés).
Attempt saved. Youssef En-Nesyri (Leganés) left footed shot from the left side of the box is saved in the centre of the goal.
Allan Nyom (Leganés) is shown the yellow card for a bad foul.
Coutinho (Barcelona) wins a free kick in the defensive half.
Foul by Allan Nyom (Leganés).
Attempt missed. Sergi Roberto (Barcelona) right footed shot from the right side of the box is too high.
Substitution, Leganés. Allan Nyom replaces Nabil El Zhar.
Foul by Gerard Piqué (Barcelona).
Sabin Merino (Leganés) wins a free kick in the attacking half.
Substitution, Leganés. Sabin Merino replaces Mikel Vesga because of an injury.
Delay over. They are ready to continue.
Delay in match Mikel Vesga (Leganés) because of an injury.
Foul by Luis Suárez (Barcelona).
Rodrigo Tarín (Leganés) wins a free kick in the defensive half.
Corner, Barcelona. Conceded by Iván Cuéllar.