Real Sociedad’s Martin Odegaard scored against his parent club to help send Real Madrid out of the Copa del Rey in a thrilling quarter-final.
The Norwegian midfielder, who is on a season-long loan, opened the scoring.
Alexander Isak netted twice in two minutes, including a superb acrobatic effort, as Sociedad went 3-0 ahead.
Marcelo and Rodrygo scored for Madrid, in between Mikel Merino adding Sociedad’s fourth, with Nacho heading in late on.
The defender’s 93rd-minute goal set up a tense finish at the Bernabeu as the referee played eight additional minutes. Although Sociedad’s Andoni Gorosabel was sent off for a second yellow card, Real Madrid were unable to find the equaliser.
Real Madrid’s Vinicius Junior had a header ruled out by the video assistant referee for offside in the second half.
It was a shock result for Zinedine Zidane’s side, who are top of La Liga and have the best defensive record in the top flight with just 13 goals conceded from 22 games.
They shipped four against a side who have won the competition just twice in their history, most recently in 1987.
The draw for the last four takes place on Friday, with Granada – who knocked out holders Valencia – and second division side Mirandes both in the pot.
Athletic Bilbao host Barcelona on Thursday in the remaining quarter-final.