Nico Gonzalez gave Barcelona just their third win under Xavi as they battled to a 3-2 home victory over Elche in LaLiga on Saturday.
The Catalans looked to be cruising to a much-needed win, Ferran Jutgla and Gavi each scoring their first goals for the club in a one-sided first half in which they had 12 shots to Elche's one.
However, Tete Morente pulled a goal back before setting up Pere Milla to level the scores barely a minute later as defensive concerns were again laid bare to the Camp Nou crowd.
But Nico swept home a fine finish in the 85th minute to snatch a morale-boosting win for the Blaugrana.
Jutgla, who scored a fine goal in the Maradona Cup exhibition match this week, broke the deadlock with a precise header from Ousmane Dembele's 16th-minute corner.
Barca's second came just three minutes later through Gavi, who spun cleverly away from Omar Mascarell, sat down Enzo Roco on the edge of the box and drilled a low finish beyond Edgar Badia.
Roco really should have pulled a goal back but somehow lofted the ball over the bar with the Barca goal at his mercy, while Frenkie de Jong and Jutgla could each have done better after being sent clear in the Elche box.
Elche continued to pose a threat on the break and they got a goal back just after the hour mark, Morente firing high past Marc-Andre ter Stegen from the right of the box after Lucas Boye played him through.
Just two minutes later, the game was all square: Milla, left unmarked at the left-hand post, stooped to head in Morente's cross, with Ter Stegen unable to keep the ball out.
Jutgla somehow turned the ball over with the goal gaping, and Nico had an effort cleared off the line by the covering Helibelton Palacios, but the Barca midfielder picked out the top-left corner superbly in the closing minutes after good work from Dembele and Gavi.