Real Sociedad stunned the champions in the 31st minute when Alvaro Odriozola finished Ander Barrenetxea’s low cross.
Barcelona equalized two minutes before half-time as Jules Kounde powered home Marcus Rashford’s corner with a forceful header.
Rashford threatened throughout the first half, testing goalkeeper Alex Remiro with dipping efforts from the left wing.
Yamal Sparks Second-Half Turnaround
With the match tied at 1-1, Hansi Flick introduced Lamine Yamal in the 58th minute.
Seconds later, the 18-year-old dribbled past a defender and floated a perfect cross into the box.
Robert Lewandowski escaped his marker and guided a clinical header past Remiro to give Barcelona the lead.
Flick substituted Rashford in the 78th minute, saving him for the upcoming Champions League clash with PSG.
Sociedad Miss Chances as Barcelona Rise to Top
Sociedad nearly equalized late when Takefusa Kubo intercepted Kounde but struck the crossbar from close range.
Moments later, Yamal set up Ferran Torres, who assisted Lewandowski, but his shot bounced off the underside of the bar.
Despite the scare, Barcelona secured their sixth win in seven league games.
The champions moved a point ahead of Real Madrid, who lost 5-2 against Atletico Madrid on Saturday.
