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 giants would have seen them climb to the top of La Liga, but they passed up that chance as their recent poor record at Anoeta Stadium continued.
The men from Camp Nou have now 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' break over 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 equaliser - Messi at half-time and Neymar shortly before the hour - but neither man was able to have the desired impact as David Moyes' struggling Sociedad lifted themselves three places to 13th, five points clear of the drop zone.
Victory completed an impressive home league treble for Sociedad, who have now beaten Real, Atletico Madrid and Barca at Anoeta this season.
POST-MATCH FEATURE: Luis Enrique makes costly Messi mistake
Barca got off to a torrid start when they 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 visitors' 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 visitors were 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 equaliser.
The visitors maintained their dominance after the interval and Andres Iniesta fired over the bar in the 59th minute.
While Barca poured forward in search of a leveller, they 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' frustrations, as Barca missed out on the chance to leapfrog their fierce rivals Real and reach the summit.