Quickfire goals from Nabil El Zhar and Real Madrid loanee Oscar Rodriguez stunned Barcelona and handed Leganes a shock 2-1 LaLiga win.
Barca had gone in front through Philippe Coutinho s fine 12th-minute touch and volley and looked in control until the home side struck in quick succession at a boisterous Butarque.
El Zhar set the turnaround in motion with a thumping back-post header soon after half-time and it was Rodriguez who capitalised on Gerard Pique s dreadful error before Barca had been given time to take stock.
Ernesto Valverde introduced Luis Suarez, Malcom and Jordi Alba off the bench but it was to no avail as Leganes, who came into Wednesday s clash bottom of the table, upset the form book in dramatic fashion.
Min. 52 Gol El Zhar (1-1)
Min. 53 Gol Óscar (2-1)
LOCURA EN BUTARQUE
— LaLiga (@LaLiga)
Lionel Messi was making his 700th Barca appearance including non-official matches and his assist for Coutinho, who flicked the ball up and volleyed into the bottom-right corner from 20 yards, put the champions ahead.
The captain struck the angle of post and bar five minutes later as the visitors dominated the opening stages although Leganes did grow into the contest and saw Youssef En-Nesyri head a presentable chance straight at Marc-Andre ter Stegen late in the half.
Ter Stegen could do little about the equaliser seven minutes after the restart, though, as El Zhar planted Jonathan Silva s looping cross into the net from close range.
And 68 seconds later Leganes were in front as Pique dispossessed En-Nesyri but, under little pressure, the defender could only stab the ball into the path of Rodriguez, who steered home for his first Leganes goal.
Barca were further frustrated 10 minutes from time as Ivan Cuellar pulled off a sensational double stop to deny Coutinho and Ivan Rakitic and secure a famous win Leganes first over the Catalan giants.
What it means: Madrid poised to capitalise on early slip
Madrid and Barca were separated only by goal difference heading into Wednesday s games but the champions first loss of the season opens the door for their rivals to go three points clear if they win at Sevilla in the later kick-off.
Coutinho s touch of class
The opener was not Coutinho s trademark finish the cut in from the left and curl into the top-right corner but there was no less skill involved and the Brazil international continues to shine in a Barca shirt.
Ponderous Pique at fault
It was not a happy outing for the defender, who was stretched by En-Nesyri s running throughout but was not being hassled unduly when he handed Rodriguez the winner on a plate.
Key Opta stats: Amazing Messi streak comes to an end
The last time Barcelona conceded two goals in a shorter space of time in a league match was against Valencia in September 2005 (David Villa scored twice in 67 seconds).
No other player has scored more goals from outside the box than Coutinho in the Europe s top five leagues since the start of last season (nine, level with Messi).
Pique has made more errors leading to goals than any other outfield player in LaLiga this season (three).
Barcelona have lost a LaLiga away game against a side from Madrid for the first time since October 2014 against Real Madrid at Santiago Bernabeu (3-1).
Messi lost a LaLiga game for the first time since May 2016 against Malaga at La Rosaleda, ending his longest unbeaten run in the competition (48 games, W38 D10).
2 are one of the two teams to have won against both Barcelona and Real Madrid in 2018 in all competitions, alongside Espanyol. Cucumber.
— OptaJose (@OptaJose)
What s next?
After one point from two matches, Barca will hope to get back on track against Athletic Bilbao at Camp Nou on Saturday, while Leganes visit Real Betis on Sunday with a spring in their step.