The win, a testament to Hansi Flick's side's resilience, was hard-earned after Real Sociedad took a surprising lead against the run of play.
Comeback Complete
Real Sociedad stunned the home crowd just after the half-hour mark when Álvaro Odriozola netted the opener in the 31st minute, capitalizing on a quick counter-attack.
However, Barcelona refused to panic. Defender Jules Koundé leveled the score just before the break (43'), rising highest to powerfully head home a corner kick delivered by Marcus Rashford, sending the teams into halftime tied at 1-1.
The decisive moment came shortly after the restart with the introduction of the returning prodigy, Lamine Yamal. Less than a minute after stepping onto the pitch for the first time since recovering from a groin injury (58'), the teenage forward delivered an inch-perfect cross that found Robert Lewandowski, whose trademark header (59') went in off the post to complete the 2-1 comeback.
Despite late pressure from the visitors, which included a shot from Takefusa Kubo hitting the crossbar, Barcelona successfully held on to secure the three points.
The victory, Barcelona's sixth in seven La Liga matches, saw them leapfrog rivals Real Madrid into first place in the standings. Midfielder Pedri earned the official Man of the Match award for his commanding and statistically dominant display in the center of the park.