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.
|Federer outlasts recovering Wawrinka|
|WATCH: Djokovic wins match, loses car|
|Bolt arrives in Sydney for A-League trial|
|Red-hot Bertens beats Svitolina, Halep marches on|
|Snedeker preserves Wyndham lead|
|Halep hits back to torment Tsurenko|
|Raonic fails to break Djokovic stranglehold|
|Emery seeks more ´demanding´ Ozil|
|CAF Champions League Review: Wydad, Al Ahly & TP Mazembe qualify|
|Stephen Curry wants to finish his career with Warriors|
|Hazard among Europe´s best but can improve, says Sarri|
|Tigers boost top-two hopes, Giants close in on fourth|
|Birmingham City 0 Swansea City 0: Monk´s men held despite dominance|
|Inter taking legal action against Tebas over Modric transfer comments|
|Serie A transfer round-up: Zaza joins Torino, Parma sign Gervinho|
|Roma chief Pallotta makes light of De Laurentiis claim|
|Federer starts double-header by seeing off resilient Mayer|
|Ospina joins Napoli on loan from Arsenal|
|Klavan completes Cagliari switch|
|Djokovic holds out against Dimitrov as Raonic awaits|
|New dates confirmed for postponed Serie A fixtures|
|Halep breezes past Barty to set up Tsurenko clash on same day|
|Olesen unable to capitalise on strong start as Jamieson, Waring go clear|
|Hoffenheim tie Kramaric to four-year deal|
|Mina to miss Southampton clash while Gomes is ´weeks´ away|
|Barcelona coach Valverde dismisses Pogba speculation|
|Valverde not prioritising Champions League over defending Barcelona´s LaLiga title|
|Allegri thanks outgoing Juventus icon Marchisio|
|Pants display from Beef? Johnston forced into change of trousers in Sweden|
|Tour champion Thomas has Welsh velodrome named in his honour|
|Gloucester surprised and disappointed by RFU´s swift Cipriani charge|
|Storm skipper Smith´s back injury not ´too serious´|
|Spurs fixture switch doesn´t appeal to Guardiola|
|Brazil call up Andreas Pereira & Arthur but omit Man City stars|
|Mbappe returns to PSG squad, Kehrer set for debut|
|No Messi in Argentina squad as Simeone wins first call-up|
|England man Roy embarrassed by self-inflicted facial injury|
|Atletico Madrid fined for breaching third-party regulations|
|Cipriani charged by RFU after common assault conviction|
|No contact, no negotiation - Leonardo denies AC Milan deal for Milinkovic-Savic|
|Kovacic set for Chelsea debut against Arsenal|
|Fury´s father restrained as Wilder crashes Pianeta weigh-in|
|Kohli and Bumrah fit for win-or-bust Test|
|Stokes ready and desperate to help England, says Root|
|Salah, Mane and Firmino not in competition says Klopp|
|Darmian staying at Manchester United, says Mourinho|
|Guardiola cites fatigue as factor for stricken De Bruyne|
|Kovac approves Rudy departure from bloated Bayern midfield|
|Klopp insists no player leaves without his approval amid Klavan rumours|
|Real Madrid complain to FIFA over Inter´s alleged Modric approach|
|Mourinho ´has never been so happy´ with unsettled Pogba|
|Manly implode amid Barrett uncertainty, Storm´s Smith injured|
|Sarri certain Hazard is staying at Chelsea|
|Liverpool, Champions League, Manchester derby - The matches De Bruyne will miss due to injury|
|Campbell joins Frosinone from Arsenal on permanent deal|
|Schalke sign Lille´s Mendyl to end left-back hunt|
|Stokes back in England team as Curran drops out|
|Ronaldo doesn´t guarantee Juventus the title, warns Allegri|
|Tuchel keen to guide PSG star Mbappe after World Cup heroics|
|Yuri: I can see Neymar joining Real Madrid|
|Milan pounce for Castillejo as Bacca joins Villarreal permanently|
|De Bruyne to miss three months for Manchester City|
|Manchester City talent Arzani completes Celtic loan|
|I know how precious my career is, says regretful Cipriani|
|Paulo Bento named new South Korea coach|
|Milan complete Laxalt deal|
|Poyet suspended by Bordeaux after outburst against board|
|Tuchel will let Neymar and Cavani settle penalties themselves|
|Hooper: We´re ready, bring on the All Blacks!|
|Outstanding Australia deserve our respect - Read|