Lamine Yamal smashed a penalty on to the post in the first half
Lamine Yamal missed a penalty as Barcelona spurned the chance to return to the top of La Liga, falling to defeat in a fiery Catalan derby against Girona.
Hansi Flick's side now trail arch rivals Real Madrid by two points in the title race after substitute Fran Beltran struck in the 86th minute at Estadio Montilivi to snatch all three points and ease relegation fears for the home side.
The visitors thought defender Jules Kounde had been fouled in the build-up to the winner, but after a brief video assistant referee (VAR) check the goal was given.
The hosts were reduced to 10 men midway through stoppage time, with substitute Joel Roca bringing down Lamine Yamal with a lunging challenge.
Yet Barcelona were unable to force an equaliser as they succumbed to just a third league defeat against their regional rivals.
The result marks a second loss in succession for Barcelona, who suffered a 4-0 hammering by Atletico Madrid in the first leg of their Copa del Rey semi-final on Thursday.
It was a fiercely fought contest from the off as the hosts took the game to the league leaders, forcing keeper Joan Garcia into a save inside the first minute.
By contrast Barcelona were lethargic, spurning several gilt-edged chances to take the lead. Lamine Yamal was the main culprit, twice missing from close range before crashing a penalty off the base of the upright in first-half stoppage time.
In the end two defenders combined to break the deadlock on 59 minutes. Centre-back Pau Cubarsi looped a header into the top corner from right-back Kounde's cross for his first league goal in Barcelona colours.
The visitors' joy was short-lived though, as Girona hit back two minutes later when midfielder Thomas Lemar tapped home Vladyslav Vanat's centre for his second goal in as many games.
The hosts scored again 10 minutes later as Garcia failed to claim Viktor Tsygankov's speculative header, though the goalkeeper was awarded a foul for a shove from Roca on the goalline.
The victory ends a three-game winless run for Girona, who move up to 12th, five points clear of the relegation zone.
Barcelona's league winning run ends at three games, and they face a possible five-point gap at the summit come their next fixture - Real Madrid head to Osasuna on Saturday (17:30 GMT), before Barca host Levante on Sunday (15:15).