Carlos Vela and Imanol Agirretxe found the back of the net in the first match since the team's manager was fired.
Real Sociedad responded to Jagoba Arrasate's sacking to put in a spirited display and beat 10-man Atletico Madrid 2-1 at Anoeta on Sunday.
A run of eight games without a win, including five defeats, led to Sociedad dismissing Arrasate earlier in the week, with former Manchester United boss David Moyes strongly tipped to replace him.
However, its sole triumph of the Liga campaign came when beating Real Madrid 4-2 on home turf at the end of August and it again raised its game against visitors from the capital.
Mario Mandzukic gave the champion an early advantage, but Carlos Vela quickly equalized and could have had a penalty in an even first half.
Diego Simeone's men were seeking a sixth straight victory in all competitions but lost Guilherme Siqueira to a red card after 50 minutes.
Two more spot-kick decisions then went against the home team, but Imanol Agirretxe - one of six changes made by B team coach Asier Santana in temporary charge of the seniors - headed in a deserved late winner.
Atletico boss Simeone kept faith with the same starting lineup which beat Malmo 2-0 in the UEFA Champions League on Tuesday, which meant Antoine Griezmann was on the bench against his former club.
Perhaps more settled as a result of their familiarity, the visitors were in front after 10 minutes when Raul Garcia put in a teasing ball across the face of the goal and Mandzukic was at the far post to fire into the roof of the net.
However, Sociedad replied within five minutes when Vela curled in a sweetly struck left-foot shot from just outside the area which found the bottom-left corner.
Atletico was given a reprieve when Diego Godin appeared to just clip Vela inside the box, with the striker booked for diving instead.
The champion survived another scare when Agirretxe pounced on a poor back-pass by Miranda and rounded Miguel Angel Moya, only for his shot to be cleared off the line by a scrambling Godin.
Atletico were reduced to 10 men early in the second period when Siqueira was sent off for a second bookable offence after fouling Vela, who then had another penalty appeal turned down.
Mandzukic missed a great chance to put Madrid back in front when blasting wide after a great cut-back from substitute Cristian Ansaldi.
Sociedad were again denied a spot kick when the ball struck Ansaldi's arm just inside the area, referee Alfonso Alvarez waving away stern protests.
However, it gained just reward for a fine performance when substitute Joseba Zaldua whipped in a cross for Agirretxe, who grabbed just his second of the season to lift the Basque club out of the relegation zone.