Their perfect start to the LaLiga campaign looked in danger of coming to a crashing halt as Aritz Elustondo's fine finish early on gave the hosts the lead.
Sociedad squandered three glorious opportunities on the break in quick succession just before the hour to put the game out of sight, profligacy that was duly punished by the ruthless visitors.
Luis Suarez was quickest to react to a loose ball from a goalmouth scramble to level in the 63rd minute before Ousmane Dembele's low effort took two deflections on its way into the net to secure maximum points for the Catalan side just three minutes later.
Sociedad had started brightly and were rewarded in the 12th minute when Elustondo lashed in a superb half-volley after Hector Moreno's back-post header was deflected into his path.
Barcelona struggled to get a foothold in the game after that early setback, but could have twice levelled through Gerard Pique shortly before the interval.
Barca threw Philippe Coutinho on at the break in an attempt to inject some life into their listless attack, but it was the hosts who looked most likely to score the next goal.
In a remarkable passage of play, Sociedad missed three one-on-ones in the space of four minutes. Mikel Oyarzabal flashed over after springing the offside trap, before Marc-Andre ter Stegen thwarted Theo Hernandez and Juanmi.
Those misses came back to haunt them almost immediately as Suarez thumped home from close range and then Dembele took advantage of poor defending from a corner to scuff home from 15 yards.
Juanmi should have snatched a late point for the hosts, but his free header sailed agonisingly wide as Barca ultimately held on for a fourth LaLiga win on the spin.
What it means: Barca setting the pace
They were some way off the side that thumped Huesca 8-2 before the international break, but Barcelona proved they can win ugly – often the sign of champions. They can now sit back and see if Real Madrid can keep pace when they visit Athletic Bilbao later on Saturday.