The 21-year-old playmaker opened the scoring midway through the first half at the Santiago Bernabeu, assisted by a dreadful goalkeeping error from Alphonse Areola.
That was Odegaard’s sixth goal within the initial season of a planned 2-campaign loan stint in San Sebastian and Sociedad striker Alexander Isak then took centre stage with two goals in as several second-half minutes.
Mikel merino created it 4-1 after Marcelo force one back for Madrid, and Sociedad held out to hand Zinedine Zidane’s shuffled line-up a first defeat in twenty two matches, despite goals from Rodrygo Goes and nacho and a red card for Andoni Gorosabel in an exceedingly riotous finale.
Areola erred terribly to reward an enterprising begin from Sociedad, pushing Isak’s strike into Odegaard’s path before permitting the midfielder’s first-time follow-up to slip embarrassingly through his legs.
James Rodriguez’s shot from the sting of the box Drew a fine stop from Alex Remiro low to his right, with the real Sociedad goalkeeper denying Vinicius Jnr and Federico Valverde in fast succession before Sergio Ramos planted a 39th-minute header against the crossbar from an offside position.
Isak’s obstinate finishing had threatened to undermine Sociedad’s fine work throughout the first half and he had a 49th-minute effort chalked off once a var review showed him to be offside on the end of Odegaard’s throughball.
But the Sweden forward swivelled to beautifully volley a chipped cross from Ander Barrenetxea – on as a half-time replacement for Adnan Januzaj – into the highest left corner.
Isak then made additional mockery of his earlier wastefulness by thundering an unstoppable shot high on the far side Areola from Nacho’s mishit clearance.
Unfortunately for the guests, Remiro’s earlier sureness deserted him as Marcelo laid-off through his grasp at the close to post, handing Madrid a 59th-minute lifeline.
More slapdash defensive sealed their fate, however, with merino the unlikely and unmarked beneficiary once Isak turned provider.
Madrid almost dug themselves out of a hole of their own creating, with Vinicius cutting back for Rodrygo to slam in when having a header of his own disallowed for offside .
Nacho’s stoppage-time header and Gorosabel’s second yellow card, for a foul on Vinicius, meant Sociedad stumbled over the road in an exceedingly manner at odds with their earlier brilliance.