Barcelona snatched an unlikely victory after Ronald Araujo headed home the only goal of the game in the third minute of stoppage time at Real Sociedad.
The defending LaLiga champions had captain Marc-Andre ter Stegen to thank after the German goalkeeper made several crucial saves to keep an energetic Sociedad side at bay.
Xavi’s side struggled to muster any genuine openings until the final embers of the match and cruelly took all three points when Araujo planted a power header through the legs of goalkeeper Alex Remiro, which was initially ruled offside, with virtually the last attack to seal the 1-0 victory.
The hosts made a rapid start when Ander Barrenetxea forced ter Stegen into a fine diving save inside the first minute.
Aihen Munoz was next to try his luck and should have done better, while Mikel Merino glanced a free header wide during a frentic opening three minutes.
La Real continued their momentum as Barcelona struggled to get into the match and Takefusa Kubo found himself with a great chance to break the deadlock, but ter Stegen denied the Japan international’s fierce far-post effort.
Mikel Oyarzabal should have done better when he latched on to a slack back pass from Barca defender Jules Kounde, but the Sociedad captain poked his effort wide when one-on-one with ter Stegen.
Sociedad ensured play was deep in Barca’s half and piled on the pressure further through a series of corners around the half-hour mark, which created more opportunities to opening the scoring.
Martin Zubimendi juggled the half-clearance from a Kubo corner before sending in a low cross. His centre was deflected to ter Stegen, but he spilled the ball and Oyarzabal was fastest to react as he stabbed an effort goalwards, only to be denied by the goalkeeper for another corner.
As half-time approached, Barcelona appealed for two penalties, firstly when Robert Lewandowski went down under a challenge before Joao Felix jinked past Zubeldia, where there was substantial contact, but referee Javier Alberola Rojas and VAR decided it was not worthy of a spot-kick.
In the 66th minute, the home side appealed for a penalty when Oyarzabal was felled in the area but to no avail, before Sociedad tested the visitors’ goal once more.
A long throw was half-cleared by the Barcelona defence, which fell in the direct of Barrenetxea on the edge of the box to fire a brilliant volley which was pushed wide by ter Stegen.
From the following corner, Kubo then raced around Gavi to get to the byline inside the area, but his cutback was cleared by a retreating Pedri.
Substitute Raphinha fired a 25-yard free-kick just over for the away team before they produced one of their best moves of the match, with a flowing counter-attack resulting in Ferran Torres picking up the ball on the edge of the area, but he blazed way over.
Barcelona almost snatched victory when another break led Pedri to patiently lay off to Gavi inside the area, but his effort was expertly saved by Remiro.
Araujo initially looked in anguish as he headed home Ilkay Gundogan’s teasing cross after the assistant flagged him offside. However, following a VAR check, the Uruguayan defender had timed his run to perfection to be Xavi’s unlikely match-winner.