Barcelona's Luis Suarez shoots at goal.
Champions Barcelona fell behind following a thumping shot from Aritz Elustondo in the 12th minute from a set piece.
Real Madrid's ideal start to the La Liga season came to a halt on Saturday as they drew 1-1 in an ill-tempered game at Athletic Bilbao and fell two points behind champions Barcelona at the top of the standings.
But Luis Suarez scrambled the ball home in the 63rd minute before Ousmane Dembele converted at another corner.
The win for Ernesto Valverde's side is their fourth from four games this season and keeps them top of the table.
Valverde brought on Coutinho and Busquets early in the second half but it initially made little difference as Real Sociedad launched three counter attacks in quick succession, with only the presence of German goalkeeper Marc-Andre ter Stegen preventing the home side from doubling their lead.
Barcelona were poor in the first half and also capitalised on goalkeeping errors for both goals with Geronimo Rulli missing punches at both set pieces.
"I think you have to see a game like this to see how tough La Liga is", said Suarez. We turned around a game we were losing here last year, too, when it had been eight or nine years since a [league] win [at Anoeta].
Iker Muniain gave Athletic a deserved lead in the 32nd minute in Bilbao by bundling the ball home after Real failed to get back in time to defend a counter-attack.
Real were twice denied by Athletic's impressive 21-year-old goalkeeper Unai Simon in the first half but finally beat the youngster when Isco nodded home a cross from Gareth Bale in the 63rd minute as Real improved after bringing on midfield anchor Casemiro at the start of the second half.
Moreno's header was comfortably dealt with by Ter Stegen 10 minutes into the second half before Mikel Oyarzabal blasted over the Barcelona bar. For Suarez, it was the introduction of Philippe Coutinho: "Philippe came on and did really well".