The victory moved Los Blancos above Valencia into third spot in the table, but the reigning champions are still 16 points off league leaders Barcelona.
Zinedine Zidane's side will now switch their attentions to the European Cup as they prepare to welcome PSG to Madrid for the first leg of their last-16 tie on Wednesday night.
Sociedad made a disastrous start to the match as Lucas Vazquez - who came in for Gareth Bale - headed a Cristiano Ronaldo cross into the back of the net inside the first minute of action at the Bernabeu.
Karim Benzema had a super chance to double the advantage in the eighth minute, but the Frenchman poked against the Sociedad post from close range as the visitors continued to look shaky at the back.
Real Madrid were a threat in so many areas, and it was Ronaldo that doubled their advantage in the 27th minute when the Portuguese side-footed a low Marcelo cross into the back of the net.
Benzema then had a goal-bound strike blocked before Ronaldo clipped one against the post from inside the box.
Real Madrid had their third in the 34th minute, however, when Toni Kroos placed the ball into the far corner of the net after Sociedad afforded the German far too much space once again.
Ronaldo then made it four in the 37th minute when he headed a Kroos corner into the bottom corner. Once again the Sociedad defence went walkabouts, and Asensio passed up a good chance to make it five in the final stages of what was an embarrassing first period for the away side.
Sociedad came close to getting their name on the scoresheet early in the second half when Juanmi met a corner, with the forward's effort hitting the outside of the post.
Bale was the third player off the home side's bench in the 73rd minute, but Ronaldo and Benzema both stayed on ahead of the PSG clash.
Ronaldo then completed his hat-trick with a simple finish in the 81st minute after a strike from Bale had been palmed into the Portuguese's path.
It was Sociedad that scored the final goal of the night, however, with Asier Illarramendi finding the back of the net against his old club from inside the box as an entertaining game in Madrid produced seven goals.
The night ended on a sour night for Benzema, however, as the Frenchman, who was booed by sections of the Bernabeu support throughout the match, missed a gilt-edged chance in the final seconds.
REAL MADRID (4-3-3): Navas; Carvajal, Ramos, Varane, Marcelo; Kroos, Modric (Kovacic 63'), Asensio (Bale 73'); Lucas (Isco 63'), Benzema, Ronaldo
REAL SOCIEDAD (4-2-3-1): Rulli; Odriozola, Navas, Elustondo, De la Bella; Illarra, Zurutuza (Zubeldia 60'); Prieto, Canales (Bautista 60'), Oyarzabal; Juanmi (Guridi 83')