Oscar Melendo's late goal saw Espanyol snatch a 1-0 win and inflict a first defeat on Barcelona since August, after Lionel Messi failed to score a penalty in the first leg of the Copa del Rey quarter-finals.
A dominant Barca looked as though they would have to settle for a goalless draw after Messi saw his second-half spot kick saved by Diego Lopez on Wednesday, but worse was to come for the Liga frontrunners.
Espanyol caught them on the break late on and youngster Melendo provided a neat finish for his first senior goal, inflicting a first defeat on Barca since their Supercopa de Espana losses to Real Madrid.
Barca were on top from start to finish and created more than enough chances to take a victory back to Camp Nou.
But for all their control, the first half proved particularly frustrating, as clear-cut chances were hard to come by and, when the visitors did manage to craft an opening, the opportunity was wasted or saved.
They should have taken the lead just after the hour mark when Messi stepped up from 12 yards out, but Lopez rescued Espanyol with a brilliant save and Melendo – introduced from the bench – struck two minutes from time to secure an unlikely victory for the home side.
Barcelona did not have much trouble taking control of proceedings early on, as they enjoyed a monopoly on possession.
Chances were by no means a regular occurrence, however, with an eighth-minute Sergio Busquets effort that Lopez did well to parry away being the only opportunity at either end in the first quarter of the match.
Messi eventually burst into life in the 23rd minute and managed to charge through a crowd of players to get a shot away, only for Lopez to make light work of the effort.
At the other end, Barca looked almost too comfortable and such a relaxed approach nearly cost them, as Sergi Roberto gifted possession to Gerard Moreno and the forward fired just wide of the bottom-right corner.
The best chance of the half fell to Denis Suarez just before the break, though, as the midfielder received Messi's pass in the area and shot into the side-netting.
Barca's dominance continued into the second half and a moment of Messi magic forced Lopez into action, as the Argentinian flicked the ball over his head and drilled a volley towards the bottom-right corner from 18 yards, with the goalkeeper getting down to keep it out.
Valverde's frustration brought about the introduction of Ivan Rakitic and Luis Suarez from the bench and soon after the Uruguayan's entrance, Barca won a penalty.
Roberto found his way into the Espanyol area and went down under a clumsy Esteban Granero challenge, but Lopez brilliantly denied Messi's kick, getting down to his left and tipping it wide.
3 - Lionel Messi has missed more penalties than any other La Liga player this season in all competitions (three from six attempts). Strange. pic.twitter.com/rVgz6du5nY— OptaJose (@OptaJose) January 17, 2018
In an incident that will likely result in a sanction for Espanyol, Barca goalkeeper Jasper Cillessen appeared to get caught in the face by something thrown from the stands 13 minutes from the end.
Thankfully he was fine to continue and he made a strong save to push Marco Navarro's fierce free-kick effort over.
But he was helpless a few moments from the end when Melendo latched on to Navarro's well-placed cut-back and steered a cushioned left-footed finish into the bottom-left corner, ending Barca's 29-match unbeaten run.
|Real Madrid hurt you with nothing – Xavi says PSG loss an injustice|
|Conte: Chelsea need perfect game to stop Messi and Barcelona|
|LeBron James thanks Ingraham as Cavs All-Star vows to speak his mind|
|Archer says Rays could have best rotation in baseball|
|Bubba Watson takes lead with 65 at Genesis Open|
|Inter in a fragile moment, says Spalletti|
|Groves batters Eubank Jr to retain WBA crown|
|Montpellier see off plucky Oyonnax, Ashton stars in Stade mauling|
|Booed Emery praises PSG´s mental strength|
|Cavani hails ´good reaction´ as PSG bounce back in style|
|Thiem breezes past Monfils to set up Bedene showdown|
|Mourinho wants referees to have final say on VAR|
|Genoa 2 Inter 0: Pandev piles misery on old employers|
|Manchester United to host Brighton in FA Cup quarter-finals|
|Leinster see off Scarlets as Munster come up short in Cardiff|
|New No.1 Federer earns gritty Seppi win to book Rotterdam final|
|Mata ´still up for VAR´ despite disallowed goal at Huddersfield|
|Valverde: Barcelona had to suffer at Eibar|
|Championship Review: Fulham end Villa run, Cardiff pounce|
|Resilient Kvitova ousts Wozniacki in Doha thriller|
|Huddersfield Town 0 Manchester United 2: Lukaku sends visitors through after VAR controversy|
|Toomua inspires Tigers win over Quins, Worcester beat Gloucester|
|Bayern Munich boss Heynckes hails game-changing Muller|
|Locadia benefiting from ´competitive´ Brighton - Hughton|
|Baby on board? Alba dedicates Barca goal to girlfriend|
|West Brom future ´not a decision for me´, says Pardew|
|Lions get De Bruin off to winning start|
|Paris Saint-Germain 5 Strasbourg 2: Cavani at the double in bounce-back win|
|Bar-celona! Messi posts unwanted record|
|Barca go 31 LaLiga games unbeaten to tie club record|
|Mourinho: I don´t know and I don´t care when Pogba returns|
|Brighton and Hove Albion 3 Coventry City 1: Locadia, Ulloa lead Seagulls to quarter-finals|
|EIbar 0 Barcelona 2: Suarez and Alba seal points as Orellana sees red|
|West Brom 1 Southampton 2: Rondon stunner in vain as Baggies drop out|
|Wolfsburg 1 Bayern Munich 2: Lewandowski spot-on after Robben´s penalty miss|
|I hope Cutrone finds a beautiful girlfriend so he can rest and make love - Gattuso|
|Wellens claims Ruta del Sol lead, Froome suffers puncture|
|Goffin forced to retire in Rotterdam following freak eye injury|
|Allegri denies Champions League ´obsession´ ahead of Turin derby|
|Barry, Evans start for West Brom after training camp incident|
|Bottas unaffected by ´Halo´ on simulation runs|
|Sheffield Wednesday 0 Swansea City 0: Carvalhal settles for replay on Hillsborough return|
|Management ´tiring´ but Zidane not ready to leave Madrid just yet|
|Thiago back for Bayern as Heynckes rests stars for Besiktas|
|Simeone urges Atletico fans to get behind Griezmann|
|Robben amazed by Guardiola´s impact at Manchester City|
|Three-way tie for lead in Oman as Pavon falls away|
|McIlroy frustrated by added scrutiny of playing with Woods|
|Morgan to take it slow with Stokes and backs Rashid|
|Pogba out of Man Utd´s Huddersfield trip with illness|
|A-League Review: Perth ´Panenka´ punished, 10-man Adelaide rescue late draw|
|Dragons and Rabbitohs see off Super League opponents|
|Robben targets two more years at the ´highest level´|
|Rashford and Herrera ´have a chance´ of making Sevilla trip|
|Mixed feelings for Tiger Woods after missed cut at Riviera|
|Emery defends PSG star Neymar after Madrid display|
|Nishikori stays hot in New York as Anderson awaits|
|Kevin Durant: Laura Ingraham´s ignorant comment was racist|
|Thiem sets up Monfils semi-final showdown|
|Mahrez saga now over, says Leicester boss Puel|
|Cantlay, McDowell and Saunders top at Riviera as Woods makes early exit|
|Tiger Woods misses cut at Genesis Open|
|Astros manager Hinch on Cole: He doesn´t need to be fixed|
|Alonso to return for Barca clash but Bakayoko set to miss first leg – Conte|
|Mourinho: Manchester United will sign a midfielder|
|Record-breaking Federer rises back to summit, Goffin to meet Dimitrov|
|Kobe Bryant says Lakers ´shouldn´t need´ to recruit free agents|
|Federer pokes fun at himself after becoming oldest world number one|
|Woods to play Honda Classic as comeback continues|
|Glasgow Warriors book finals berth as Zebre upset Connacht|