Barcelona needed Lionel Messi's last-gasp penalty to beat struggling Leganes 2-1 as the Catalans issued an unconvincing response to their Champions League hammering.
Luis Enrique's side were looking to bounce back from being thrashed 4-0 by Paris St Germain on Tuesday but while they did manage a victory, they will take less satisfaction from another shaky performance.
Leganes, who remain 17th in LaLiga and just two points above the relegation zone, looked on course for a deserved draw when substitute Unai Lopez cancelled out Messi's opener with 19 minutes to play.
But Messi, as he has so often this season, bailed Barcelona out with an 89th-minute penalty after Martin Mantovani had fouled Neymar in the box.
The win puts Barca a point behind league leaders Real Madrid, although the capital club have two games in hand over their rivals and the pressure is unlikely to ease on under-fire manager Luis Enrique.
Real Sociedad missed the chance to move closer to Atletico Madrid and the Champions League places after they were beaten by Villarreal earlier on Sunday in a battle of fifth against sixth.
A disappointing contest was won in the 90th minute by Villarreal's Samu Castillejo, who converted Jaume Costa's cross to seal a first victory in four matches for Fran Escriba's side.
It means Sociedad remain fifth and four points adrift of Atletico, while they are now only two ahead of Villarreal.
At the opposite end of the table, Valencia snatched a much-needed 2-0 victory against eighth-placed Athletic Bilbao to steer seven points clear of the relegation zone.
Former Manchester United winger Nani opened the scoring before Simone Zaza added a second on the stroke of half-time.
There was no such respite for bottom-side Osasuna, however, who lost 3-0 at Celta Vigo.
Pione Sisto, Iago Aspas and Jozabed were all amongst the goals as Celta Vigo climbed up to ninth. Osasuna sit eight points adrift of safety.