Barcelona suffered their first defeat under Xavi Hernandez on Saturday as a 1-0 loss at home to Real Betis inflicted another blow on their hopes of catching La Liga's top four.
A surprise defeat at Camp Nou damages Barca's bid to qualify for next season's Champions League, four days before they attempt to avoid crashing out in the group stage of the current one. Barca have to win at Bayern Munich on Wednesday to be sure of going through.
This was hardly ideal preparation as a brilliant Betis counter-attack, finished by Juanmi in the 79th minute, consigned Barcelona to their fourth league defeat of the season.
"That goal annoyed me a lot because we had worked on those situations," said Xavi. "We didn't deserve to lose."
The result leaves Barcelona a daunting six points behind fourth-placed Atletico Madrid, who play a game in hand at home to Mallorca on Saturday.
They will also be 16 points behind leaders Real Madrid if Madrid win at Real Sociedad while Betis moved into the third to continue their excellent start to the campaign.
Gavi is unlikely to be available against Bayern after the midfielder had to be taken to hospital "according to protocol", said the club, for a head injury.
The 17-year-old was substituted in the first half after a Hector Bellerin clearance saw the ball strike his head from close range.
Xavi had started with two wins out of two in La Liga but even he admitted the results owed a lot to good fortune, with Espanyol and then Villarreal guilty of squandering chances.
In between, a goalless draw at home to Benfica in the Champions League exposed Barcelona's ongoing problems in front of goal and that was evident against Betis, who were relatively untroubled throughout.
Ousmane Dembele, who come on off the bench, posed the greatest threat while the 19-year-old Abde Ezzalzouli missed a golden opportunity to equalise late on when the ball was cut back to him eight yards out. The youngster blazed over.
Minutes before, Betis showed far more composure to finish off a slick counter-attack.
Sergio Canales broke free down the right but the move appeared to have lost its momentum when Canales pulled back to Cristian Tello on the edge of the area.
Instead, Tello shifted the ball quickly left to the arriving Juanmi, who took one touch before sliding into the corner.
Earlier, Sevilla reduced the gap to Real Madrid to five points by beating Villarreal 1-0, with Lucas Ocampos scoring the winner in the first half.