Barcelona manager Ernesto Valverde was relieved to come out of a tough game against bottom-of the table Leganes with three points.
Youssef En-Nesyri gave the hosts an early lead with a superb effort as Barcelona struggled to create anything of any note.
But they improved after the break and second-half efforts from Luis Suarez and Arturo Vidal secured a 2-1 victory and moved them three points clear at the top, although Real Madrid have the opportunity to move level when they play Real Sociedad later on Saturday.
Valverde told reporters after the game: "It was so important (to win) because we started badly.
"It was a game played on a difficult pitch. There was a lot of wind so it was difficult to play the long ball.
"Besides, it was difficult because after they scored they closed in on us so we looked for a strategy in order to win the game but it was very difficult.
"We couldn't control the ball well. It bounced a lot and this meant that we couldn't play our game.
"Leganes played a very good defensive game."
Vidal was happy to hit the winning goal after a tricky week off domestic duties during the international break.
Vidal won it when Ousmane Dembele's corner from the right bounced off the inside of Ruben Perez's right boot and towards the Chile international, who would have been well offside had the ball come off a Barcelona player, and he mishit a shot over Ivan Cuellar and into the net.
After a VAR check to determine if the ball rebounded off Perez or Ivan Rakitic the goal was awarded.
Vidal said: "We're happy for the three points and I'm happy because I scored. We're happy because we're improving and working hard.
"It was a difficult game because they want to move up the table. It's a difficult stadium to play in. It was very cold and after a hard week without playing it was very important that we won.
"At the beginning it was very complicated and we have to improve many things, but we always fight until the end so we can get the three points."