Jordi Alba put through his own net after just two minutes of play in San Sebastian, as Luis Enrique's men failed to take advantage of Real Madrid's loss at Valencia.
Real Madrid's 2-1 loss at Valencia earlier in the day meant victory for the Catalan giant would have seen it climb to the top of La Liga, but it passed up that chance as its recent poor record at Anoeta Stadium continued.
The men from Camp Nou now have drawn two and lost four of their last six games at the home of Sociedad in all competitions.
Defeat also ended their 11-match unbeaten run, with their last reverse having come against Celta Vigo back in early November.
Luis Enrique left Lionel Messi and Neymar on the bench for the start of this match, after both men had been given an extra two days of break during the Christmas period and returned to the club later than the rest of the squad.
Unsurprisingly, both were introduced in a bid to conjure up an equalizer - Messi at halftime and Neymar shortly before the hour mark - but neither man was able to have the desired impact as David Moyes' struggling Sociedad lifted itself three places to 13th, five points clear of the drop zone.
Victory completed an impressive home league treble for Sociedad, which now has beaten Real, Atletico Madrid and Barca at Anoeta this season.
Barca got off to a torrid start when it fell behind in the opening exchanges. A corner was taken short to Sergio Canales, who whipped in a left-footed cross that Alba could only head into his own net with Claudio Bravo - returning to his former club for the first time - beaten.
The visitor's first effort of note did not arrive until the 21st minute, when Xavi curled a 25-yard free-kick narrowly over the crossbar.
Four minutes later Luis Suarez burst forward and fed Pedro, who blazed off-target with the angle against him.
Barca thought they should have had a penalty on the half hour when Pedro's cross took a deflection and struck the left arm of Inigo Martinez, but referee Carlos Del Cerro waved away the appeals.
Although the visitor was dominating possession, former Real man Canales was proving a threat on the counter-attack, and he brought a smart stop out of Bravo at his near post after leaving Martin Montoya on his backside with an adroit turn inside the penalty area.
Sociedad goalkeeper Geronimo Rulli kept out Pedro's swerving effort with his legs as Barca continued to press for an equalizer.
The visitor maintained its dominance after the interval and Andres Iniesta fired over the bar in the 59th minute.
While Barca poured forward in search of a leveler, it remained vulnerable at the back and almost fell further behind when Bravo misjudged Alberto De La Bella's cross and Xabi Prieto headed over the bar.
Neat interplay between Iniesta and Alba then set up Xavi, but his effort from just inside the box was weak and comfortable for Rulli.
As the game entered the final five minutes, Rulli raced from his line to get a fingertip on the ball as Suarez attempted to go round him and score, and the keeper then reacted smartly to keep out the Uruguayan's header.
Those two saves summed up the visitors's frustrations, as Barca missed out on the chance to leapfrog its fierce rival Real and reach the summit.