Madrid - Lionel Messi missed a penalty as Espanyol struck in the dying moments to consign Barcelona to their first defeat since August, 1-0 in the first leg of the Copa del Rey quarter-finals on Wednesday.
Oscar Melendo slotted home a neat finish with two minutes remaining of a temperamental derby cup tie, racing onto Marc Navarro's low cross to punish Messi for missing a 62nd-minute penalty and send the home crowd into raptures.
"We knew this day would come, we tried to delay it as much as possible but it couldn't be today," said Sergio Busquets after the match.
"The good thing is that we have the second leg to try to mount a comeback. We are lucky to have that game at home, and we will have to win whatever happens."
In a match of few chances Barca's penalty, which came after a foul on Sergi Roberto, looked to be the decisive moment for the away side, but Espanyol keeper Diego Lopez dived superbly to his left to push Messi's powerful shot wide.
Navarro then came close to giving the hosts the lead in the 83rd minute with a dipping free-kick that forced an excellent save from Jasper Cillessen, before five minutes later setting up the goal that gave Espanyol their first win over Barcelona in nearly nine years.
"This victory is important for the history of the club and to break down all those walls," said Espanyol coach Quique Sanchez Flores.
"It was telling how long ago it had been since we'd won against Barcelona, now the counter is back zero and we're immensely happy about that."
Diego Costa's third goal in four matches wasn't enough for Atletico Madrid as Sevilla twice scored late to stun their hosts 2-1 in the first leg at the Wanda Metropolitano.
Costa struck for dominant Atletico on his first appearance since being sent off for wildly celebrating his last goal, in a 2-0 league win against Getafe, this one a superb first-time shot past Sevilla keeper Sergio Rico after the ball ricocheted to him in the 73rd minute.
However Sevilla grabbed a hugely fortunate and barely deserved equaliser seven minutes later when a speculative cross deflected off Atletico defender Lucas Hernandez and was then inexplicably pushed into his own net by keeper Miguel Angel Moya.
New Sevilla coach Vincenzo Montella sealed his third win since arriving in Spain - all of coming them in the cup - with a much better goal two minutes from time, Joaquin Correa racing on to Wissam Ben Yedder's knock-on and tucking a fine finish past Moya.
Valencia came close to being shocked at their Mestalla stadium by Alaves, who are languishing in 17th place in La Liga and are just two points above the relegation zone, but Goncalo Guedes and Rodrigo scored in nine second-half minutes to overturn Ruben Sobrino's 66th-minute opener for the away side.
Struggling Real Madrid and their under-fire boss Zinedine Zidane travel to Leganes on Thursday hoping to banish all talk of a crisis at the domestic and European champions after the weekend's shock home defeat to Villarreal.