Madrid: Barcelona needed a last minute Lionel Messi penalty to see off lowly Leganes 2-1 as a poor week for the Spanish champions continued on Sunday.
Barca were thrashed 4-0 by Paris Saint-Germain on Tuesday to leave their Champions League hopes hanging by a thread and had to rely on Messi for snatching all three points from another below par display.
The Argentine opened the scoring after just four minutes, but Leganes enjoyed the better of the chances and levelled 19 minutes from time through Unai Lopez.
However, Messi ensured Barca did move back up to second in La Liga and close to within a point of leaders Real Madrid, who have two games in hand, from the spot after Neymar had been chopped down inside the area.
"We knew it would be a difficult game given what we have come from and what happened in the Champions League," Barca boss Luis Enrique told Spanish TV station Movistar.
"It is clear that in some moments we lacked confidence, but I think the team turned around a difficult game in any way we could. This time it was a penalty, but, given how we are at the moment, that is more than welcome."
Leganes remain just two points above the relegation zone as their winless run extends to 13 games.
Barca looked set for an easy night when Luis Suarez found space in behind the Leganes defence and his pinpoint cross with the outside of his right foot picked out Messi to tap home early on.
Instead, Barca were thankful to a series of brilliant saves by Marc-Andre ter Stegen for keeping Leganes at bay.
The German denied former Liverpool winger Nabil El Zhar in a one-on-one before flying low to his left to parry El Zhar's follow-up effort.
El Zhar came close again with the last action of the first-half as this time his shot from the edge of the area was deflected and forced Ter Stegen into a fine reflex stop.
However, for all his good work, Ter Stegen was at fault when Leganes did deservedly level as Lopez's effort from the edge of the area flew in between his legs.
- Barca booed -
The equaliser was met with a chorus of boos by the lowest La Liga attendance at the Camp Nou this season. And there was an even angrier reception for the much maligned Andre Gomes when he was replaced by Andres Iniesta moments later.
"For me jeering a player on your own team makes no sense," added Enrique.
And Ter Stegen called for unity among the Barcelona faithful.
"We need the fans, above all at home, to support us. We can win or lose together, but the most important thing is that we are united."
Leganes had held out with relative ease until Neymar took matters into his own hands with a driving run into the area before he was wiped out by Martin Mantovani.
Messi stepped up and fired into the top corner, but tellingly the Argentine didn't celebrate leaving his displeasure with Barca's performances over the past week clear.
Leganes still had a late chance to level as El Zhar sent another fierce effort flying inches wide. Earlier, Villarreal kept their hopes of Champions League football next season alive as Samu Castillejo's 93rd minute winner secured a vital 1-0 win at Real Sociedad.
Just a second win of 2017 takes sixth-placed Villarreal to within two points of Sociedad and six of Atletico Madrid in fourth. Valencia moved seven points clear of the relegation zone with a much-needed 2-0 win over Athletic Bilbao.
Nani opened the scoring early on before on-loan Juventus striker Simone Zaza broke down in tears after netting his first goal since May.