Ronald Araujo headed home in the 92nd minute to snatch Barcelona an undeserved 1-0 win at Real Sociedad on Saturday in La Liga.
Having suffered a last-gasp defeat by Real Madrid in the Clasico last Saturday despite having the better of the game, Xavi Hernandez's side inflicted the same suffering on Real Sociedad in San Sebastian.
Barcelona failed to create any clear chances until the final stages, with their goalkeeper Marc-Andre Ter Stegen keeping the score level, before Araujo headed Ilkay Gundogan's cross home with seconds remaining.
The victory takes Barcelona third, two points above Atletico Madrid, who lost on Friday at Las Palmas and one point behind second place Real Madrid, who host Rayo Vallecano on Sunday.
Girona provisionally lead La Liga by three points from Los Blancos after they came from behind to beat Osasuna earlier Saturday.
"These are three very important points after coming from the Clasico, which we lost playing well, it was really important to get the three points," Araujo told Movistar.
"We did not play well in the first half, we were a bit better in the second … it was really hard for us to come out from the back, they pressed us well."
Xavi brought Robert Lewandowski into the Barca starting line-up after he made his return from injury as a substitute against Madrid.
However the Polish forward was just as quiet as he was last weekend as the game passed him and Barcelona by for large periods.
Real Sociedad pushed the Catalans back through the first half, carving out by far the better chances but were unable to find the opener.
Within the first 30 seconds Ander Barrenetxea called Ter Stegen into action, and Barcelona's German goalkeeper soon denied Mikel Oyarzabal too.
Ter Stegen was alert to stop a Takefusa Kubo effort at the back post with his feet, with Real Sociedad getting into dangerous areas frequently.
Barcelona offered extremely little at the other end, mustering only a wayward Joao Cancelo effort in response.
Ter Stegen saved from Martin Zubimendi as the hosts continued to turn the screw at the Reale Arena, playing with great intensity.
Gundogan called on his team-mates to show more after the Clasico capitulation but he was as guilty as anyone, giving the ball away too often under pressure from La Real.
Fermin Lopez produced Barcelona's first shot on target near the end of the first half, a tame low effort fielded easily by Alex Remiro.
- Tightening up -
Real Sociedad remained on top after the break but Barcelona found more stability, tightening up at the back and closing off some of the space Barrenetxea and Kubo enjoyed earlier on.
Pedri made his comeback from injury in the second half, replacing Lewandowski for his first appearance since August, as Xavi sought more control.
Ter Stegen pushed away a Barrenetxea volley from the edge of the box in the 21-year-old forward's final contribution of an impressive performance.
Substitute Ferran Torres skied a shot from the edge of the box, summing up Barcelona's night until that point, before the champions produced their first genuine chance in stoppage time.
Pedri cleverly slipped in Gavi, but Remiro denied the midfielder who should have found the net.
Their chance to snatch victory seemed to have vanished but centre-back Araujo popped up in the right place at the right time to pull off the heist.
The defeat leaves Real Sociedad sixth, after Real Betis beat Mallorca to rise above them.
"Generally we were better then them, we didn't put away our chances and they scored the one they had," Oyarzabal told Movistar.
"I think it's worse to lose without showing up, to lose without playing well ... we all wanted to win and we had chances to, but if you have to lose, I prefer to lose like this."