Sociedad stun Barcelona, Real Madrid go top
Earlier, Madrid had comfortably seen off Elche 3-0 at the Santiago Bernabeu thanks in part to a spectacular long-range strike from Gareth Bale.
Barcelona had come into the game on a high after beating Manchester City in their much-anticipated Champions League tie on Tuesday, but went behind when Alex Song turned Sergio Canales' cross into his own net.
Lionel Messi restored parity almost instantly with a clinical left-footed finish.
However, two goals in the opening 15 minutes of the second-half from Antoine Griezmann and David Zurutuza handed Sociedad a deserved victory.
Barca boss Gerardo Martino had made six changes from the side that started in Manchester as Neymar made his first start in a month.
After a slow start from the visitors, Pedro came close to opening the scoring when he sliced Andres Iniesta's pass just wide.
It was Sociedad who struck first, though, as Song bundled the ball into his own net under pressure from Gorka Elustondo.
The lead lasted only three minutes as Messi fired home his seventh goal in his last five games with an unerring finish from the edge of the area.
Sociedad should have been back in front before half-time when Carlos Vela pounced on an error from Gerard Pique, but the Mexican wastefully blasted over the bar with just Victor Valdes to beat.
Barca were dealt a blow at half-time when coach Gerardo Martino was sent to the stands for the second half after taking his protests towards the officials too far as they headed down the tunnel.
And the Catalans' defence also seemed to completely lose their composure at the start of the second-half as Sociedad opened them up at will.
Vela raced onto a long ball in behind the Barca defence to square for Griezmann to register his 15th league goal of the season on 54 minutes.
Five minutes later it was 3-1 as this time Zurutuza burst through a pedestrian defensive line to turn home Griezmann's cross from the right.
Cesc Fabregas replaced the struggling Song and Alexis Sanchez was also introduced as Barca went in search of a way back into the game.
Yet, it was Sociedad who should have added to their lead when Vela struck the base of the post nine minutes from time.
Victory moves Sociedad to within a point of Athletic Bilbao in the fourth Champions League place, while Barca could end the weekend in third should Atletico Madrid avoid defeat away to Osasuna on Sunday.
There were no such worries for Real Madrid as goals from Asier Illarramendi and Isco either side of Bale's stunner handed them a 15th win in 16 games in all competitions.
Madrid were once again without the suspended Cristiano Ronaldo as he completed a three-game ban after having a final appeal rejected on Saturday morning.
However, after an unconvincing start, Illarramendi's deflected effort gave the hosts a half-time lead.
Bale then made the game safe 19 minutes from time when he collected possession midway inside the Elche half and blasted the ball in off the underside of the bar.
And Isco rounded off a 15th win in 16 games in all competitions for Real when he slammed home the third from Karim Benzema's pass nine minutes later.
Bale had been enduring a difficult day before he found the back of the net as he consistently lost possession and even drew the ire of the Bernabeu crowd on a couple of occasions.
Madrid boss Carlo Ancelotti, however, hailed his transformation in the final 20 minutes as his confidence soared after the goal.
"He was a different player before and after the goal," said Ancelotti.
"Before he was playing without confidence and then everything changed. Obviously, given the type of player he is, the goal helped him a lot.
"It is difficult to play against a well-organised team and it is difficult to find space. Before the goal he did ok, but after he was brilliant."
Related Barcelona News