Arturo Vidal struck 11 minutes from time to earn Barcelona a 2-1 victory away at Leganes on Saturday.
Manager Ernesto Valverde has been under pressure since last season’s Champions League semifinal exit to Liverpool and, despite sitting in first place, they only narrowly avoided dropping points for fifth time in 13 matches.
Youssef En-Nesyri opened the scoring for Leganes in superb fashion on 12 minutes when he fired in a superb effort from the right hand side of the box.
There was a potentially significant moment just after the half hour mark when Sergio Busquets picked up a booking for a foul on Roque Mesa which rules him out of the mammoth clash away to Atletico Madrid.
With Barca pushing for a winner, Valverde opted to take off Antoine Greizmann just before the hour mark and replace him with Vidal. And it proved to be a decisive change.
On 79 minutes, Vidal fumbled home from close range and, following a consultation with the VAR, the goal stood and Barca took home all three points.
Vidal had been stood well offside but the referee ruled the ball had come off Leganes’ Ruben Perez.
Barcelona welcome Borussia Dortmund in the Champions League on Wednesday, where victory would guarantee qualification to the knockout phase, and Valverde said they go into that clash in good spirits.
“We have to be happy,” he said. “I know it was a brilliant game and we know it was was difficult to play here.
“Then we concede early. They were playing very deep and it was really difficult. Also because of their hunger, the pitch was really bad, the wind. But I don’t want to make excuses. It was difficult because we couldn’t play and because they defended well.
“I think we’re going into the Dortmund game with good sensations. We won — last year we lost here. It’s hard to play here because Leganes make it tough to play. They deserve credit. They’re in a tight position [at the bottom] and know the importance of every point they have.
“This was an important and tough test. You have to win at these grounds, it’s not easy. You have to know how to play at certain moments. Against Dortmund it’s a completely different challenge.”