Barcelona suffered their first home defeat in La Liga for more than two years, losing 4-3 to Real Betis despite Lionel Messi scoring twice on his return to action.
First-half goals from Junior and Joaquin gave the visitors to the Nou Camp a 2-0 lead before Messi pulled one back from the penalty spot midway through the second half.
However, Barcelona goalkeeper Marc-Andre ter Stegen then let a shot from Giovani Lo Celso slip through his hands and although substitute Arturo Vidal reduced the deficit on 79 minutes, Ivan Rakitic was sent off moments later and Sergio Canales made it 4-2 soon after.
Messi finished off a flowing move in stoppage time to make it 4-3, but Betis held on to inflict Barcelona's first defeat at the Nou Camp in La Liga since they lost 2-1 to Alaves in September 2016.
Back in the side after three weeks out with a fractured arm, Messi could have opened the scoring in the first minute, but badly miscued his left-footed shot after Malcom had cut the ball back from the left.
However, the visitors looked a threat on the counter-attack and Lo Celso surged into the area after Gerard Pique had slipped, but the Spain defender did well to get back to block the eventual shot.
Lo Celso then set up Joaquin with an inch-perfect cross, only for him to volley over the bar as the onrushing Ter Stegen did just enough to put off the Betis winger.
A trademark dribble from Messi ended with a shot blocked by Aissa Mandi before Betis took the lead with a superb counter-attack following a Barcelona corner.
William Carvalho produced a brilliant through-ball to release Junior down the left and he cut in on to his right foot in front of Sergi Roberto before beating Ter Stegen at the near post.
Barcelona tried to respond quickly and it took a great save from Pau Lopez to tip over Clement Lenglet's volley from Messi's free-kick, before Betis doubled their advantage on 34 minutes as Cristian Tello's cross was turned into the bottom corner by Joaquin.
The home side predictably started the second half in determined fashion and Messi and Luis Suarez both shot wide before they were gifted a lifeline as Tello was penalised for pulling back Jordi Alba as he tried to drive into the area.
Messi duly dispatched the spot-kick into the top corner, but Betis restored their two-goal lead just five minutes later when Lo Celso's shot went through the hands of Ter Stegen.
In a breathless finish the impressive Vidal made it 3-2 on 79 minutes, but Rakitic was sent off for a second bookable offence two minutes later and Canales quickly restored his side's two-goal cushion from Junior's cross.
Messi's second goal of the afternoon was initially ruled out for offside before the decision was overturned by VAR, but Betis held on for a famous victory.