Karim Benzema, Federico Valverde and Luka Modric scored for Los Blancos at the Santiago Bernabeu, after Willian Jose had given the visitors a second-minute lead. Modric was the star of the show, having assisted Benzema and Valverde's goals before finding the net himself.
Sociedad don't lack for quality in the final third this season, and it showed when Jose swept in a cute finish from inside the box with barely two minutes on the clock.
Jose continued to cause problems with his pace and the timing of his runs. He went close again on 13 minutes after being sent clear by on-loan Real playmaker Martin Odegaard.
The home side didn't start to flex its own attacking muscle until Modric began gaining control of possession. Once he did, the 34-year-old pass-master was effortlessly releasing runners between the lines, creating chances for left-back Ferland Mendy and Benzema in quick succession.
Modric's combination with Benzema eventually got Real back on terms, when a cross from the former was met by the head of the latter eight minute before the break. A 10th league goal of what is proving to be a prolific campaign means Benzema is keeping pace with some of the most lethal marksmen on the continent:
Benzema and Co. couldn't force their way in front before the break but were primed to seize the initiative after the restart. Once again Modric made the difference when he played in Valverde two minutes into the second half.
Surprisingly, given how effective he's been in a Real shirt, ex-Ballon d'Or winner Modrichadn't been this effective creatively in previous years:
Needing more attacking impetus prompted Zinedine Zidane to bring Gareth Bale off the bench. The Welshman replaced Rodrygo Goes in the 67th minute, but fittingly it was Modric who again proved decisive when he netted Real's third after he met Benzema's smart header down.
Modric's goal proved to be enough for Zidane's men, who withstood a late Sociedad offensive with Odegaard, Jose and Mikel Merino pulling the strings ultimately to no avail.
Real host Paris Saint-Germain in the UEFA Champions League on Tuesday, while Sociedad will return to domestic action by hosting Eibar on Saturday, November 30.