The ex-Arsenal forward scored with a close-range header after a cross by ex-Manchester City player Ferran Torres.
Marc-Andre ter Stegen saved well from Alexander Sorloth while Alexander Isak fired another chance wide.
Shortly before Aubameyang’s goal, Ousmane Dembele’s shot came back off the post.
Barca were made to work hard for the points with Sorloth missing a further two chances as Real Sociedad piled on the pressure after half-time.
The game was briefly stopped early in the second half after an object was thrown onto the pitch.
Aubameyang, 32, joined Barca on a free transfer in February after not playing for Arsenal following a disciplinary breach in December. Only Memphis Depay has scored more goals in La Liga for Barca this season.
Barca’s win lifts them into second spot on 63 points – 15 behind runaway leaders Real Madrid.
Real Sociedad remain sixth in the table – six points off a Champions League spot with five games left.
Real Madrid need four points from their last five games to secure a 35th La Liga title.