Lionel Messi missed a penalty as Barcelona's 29-match unbeaten record came to a shuddering halt at rivals Espanyol.
Messi saw his spot-kick saved by Diego Lopez before Espanyol sub Oscar Melendo scored a memorable winner two minutes from time in the first leg of their Copa del Rey quarterfinal.
Barcelona went into the game on the back of an impressive comeback victory over Real Sociedad in La Liga and eager to extend their undefeated run to 30 games.
But Melendo's late heroics secured a memorable 1-0 win for the hosts, their first over Barca since 2009.
As expected there was no Philippe Coutinho in Barca's lineup but a mounting injury list, which has accounted for France forward Ousmane Dembele, meant Messi did start.
The Argentine was involved immediately, breaking towards goal before he was hauled down by Javi Fuego 25 yards out, and then sending the free kick over the crossbar.
Sergio Busquets then hit a snap shot from the edge of the box which forced Lopez into a smart diving save.
Messi blasted two free kicks into the defensive wall before embarking on a trademark run past two defenders before his drive was caught by Lopez.
Gerard Pique had the ball in the net after half an hour, heading in off a post from a corner, but it was ruled out by a linesman's flag.
Denis Suarez should have given Barca the lead two minutes before half-time when sent clean through by Carles Alena but he dragged his shot into the sidenetting.
It was a bad miss and left Suarez's namesake Luis with his head in his hands on the substitutes' bench.
Worse was to come for Barca midway through the second half when Esteban Granero slid in on Sergi Roberto in the area to give away a penalty.
Messi stepped up but saw his spot-kick superbly saved by Lopez, diving to his left.
And Barca's misery was complete when Marc Navarro pulled the ball back to Melendo, the 20-year-old slotting a first-time finish into the bottom left corner for a dramatic winner.