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.
|Navas keeps place as Courtois waits on Madrid debut|
|Ndidi signs long-term Leicester City contract|
|Pandya tears through feeble England to put India in command|
|Alonso creates motorsport history with victory at Silverstone|
|Kovacic: Chelsea and Sarri believe in me|
|Brighton loss a big lesson for United – Pogba|
|Mistakes hit United´s confidence - Mourinho|
|Brighton and Hove Albion 3 Manchester United 2: Murray lifts Seagulls to another win over Mourinho|
|Quickfire Moon treble sets up Rhinos win|
|Manchester City celebrate win with Silva´s son|
|Brentford 2 Sheffield Wednesday 0: Maupay stars as Bees buzz by Owls|
|Guardiola delighted with fit and firing Aguero|
|Waring marks 200th event with maiden title in Gothenburg|
|Guardiola dismisses Mourinho´s ´disrespectful´ accusation|
|Hulkenberg proud to survive in F1´s pay driver era|
|It´s here, it´s real, get on with it - Dyche dismisses Europa League excuse|
|Grujic agrees Liverpool extension, joins Hertha on loan|
|Martial starts as Lukaku, Young return for Manchester United|
|Fury-Wilder to be staged in November or December - Warren|
|Manchester City 6 Huddersfield Town 1: Aguero hits hat-trick as champions triumph|
|Burnley 1 Watford 3: Hornets end away day woes as Deeney leads destructive display|
|McFarland cleared to leave Scotland and join Ulster|
|Simeone wants ´only the best´ for Filipe Luis amid PSG links|
|PSG signing Boateng rated ´50-50´ by Bayern president|
|Cipriani a positive influence, insists Gloucester head coach|
|Bayer Leverkusen´s Bailey signs contract extension|
|Jesus and Aguero start for City as Mahrez misses out|
|Federer unsure what to expect from Djokovic duel|
|Chievo goalkeeper suffers broken nose, whiplash in Ronaldo collision|
|Simmons lauds influence of ´big brother´ LeBron|
|PSG´s Cavani selected by Uruguay as Coito fills in for Tabarez|
|Starc leads tributes after ´leader of the pack´ Johnson retires|
|Hazard confirms he is staying at Chelsea this month|
|Liverpool´s Firmino dreaming of Premier League title glory|
|Raiders rock the Roosters as NRL´s top-four battle hots up|
|Erasmus demands improved Springboks|
|Athletics pull even with Astros in AL West|
|Mercurial quick Johnson retires from cricket|
|MLS Review: Royer leaves it late for Red Bulls, Dallas bounce back|
|Crotty concussed, Folau injured|
|DFB president Grindel sorry Ozil felt ´deserted´|
|Busch picks up first win of season in Night Race|
|NASCAR results at Bristol: Kurt Busch picks up first win of season in Night Race|
|Woakes welcomes back ´big-game player´ Stokes|
|´Genius´ Messi still amazes Valverde|
|All Blacks, Springboks await Namibia at Rugby World Cup|
|Federer to face Djokovic after Goffin withdraws|
|Rain halts plays at Wyndham Championship|
|De Gea will extend contract soon, says Mourinho|
|Halep to meet Bertens in Cincinnati final|
|Frampton set for Warrington fight after dominant Windsor Park win|
|Messi makes LaLiga history with Barcelona´s 6000th goal|
|MC Alger defeat throws quarter-final chase wide open|
|Barcelona 3 Deportivo Alaves 0: Messi´s milestone goal sets up victory|
|Djokovic on course for Masters 1000 history after Cilic victory|
|It´s on! - Wilder fight confirmed after Fury defeats Pianeta|
|Like Cruyff before him, Guardiola favouring Foden´s style over substance|
|Ronaldo tweets debut delight after Juve win|
|Chelsea are not title contenders yet, claims Sarri|
|Bayern Munich boss Kovac planning for Boateng stay|
|Championship Review: West Brom crush QPR as Leeds stay perfect|
|Allegri pleased with Ronaldo despite goalless Juventus debut|
|Chelsea can produce magic with Sarri in charge - Hazard|
|Emery ´happy without the result´ as Arsenal comeback falls short|
|Gordon confirms Cleveland Browns return|
|Eight shots and only 30 passes - Ronaldo´s Juventus debut in Opta numbers|
|Cristiano Ronaldo´s debuts: Best impressed, scoring a penalty & a blank for Juventus|
|Old boy Escare haunts Catalans in big Wigan win|
|Preston North End 2 Stoke City 2: Super sub Crouch salvages a point|
|Pochettino vows not to discuss Alderweireld future before five-minute answer|