A last-minute Athletic Club goal saw Real Madrid exit the Copa del Rey at the quarter-final stage at San Mames on Thursday night.
Real sat back and weathered the storm in the first period, with the hosts' high press and energetic attacking play a bit frantic at times as they spurned a number of half-chances.
Athletic midfielder Dani Garcia saw a venomous long-range strike palmed away by Thibaut Courtois inside ten minutes, before having a fizzing low drive blocked by Nacho.
Midway through the half Iker Muniain squeezed between two defenders and got to the byline, but he was only able to hit the side netting from a tight angle.
The second half followed a similar pattern, with the match becoming increasingly scrappy and stretched as the minutes ticked by.
Raul Garcia's header deflected just wide five minutes after the restart, but there was not another clear-cut opportunity until Casemiro fired straight at the goalkeeper from an awkward angle with nine minutes to go.
Out of absolutely nothing, Athletic snatched a winner - although Real Madrid played their part in gifting it to them. in the last minute of normal time, both Luka Modric and Casemiro failed to execute simple clearances and the ball found its way to substitute Alex Berenguer.
The winger brilliantly chopped inside Nacho before unleashing a perfect, left-footed effort across Courtois and into the bottom corner from just inside the box to lift the lid off the San Mames and knock Real out at the death.
In the night's other quarter-final, Athletic's Basque rivals Real Sociedad were thumped 4-0 at home by the impressive Real Betis.
Here's how Los Blancos' players rated...
Real Madrid player ratings
1. Goalkeeper & defenders
Thibaut Courtois (GK) - 6/10 - Read an early ball over the top well. Good save to deny Garcia shortly after. Barely tested until Berenguer's strike flew past him.
Lucas Vazquez (RB) - 6/10 - Not a right-back but rarely tested on his flank.
Eder Militao (CB) - 8/10 - Brilliant, potentially goal-saving challenge shortly after the half-hour mark. An absolute rock throughout, on the ground and in the air.
Nacho (CB) - 6/10 - Equally pretty solid, if slightly less spectacular in his defending. Turned brilliantly and left for dead by Berenguer for the winner.
David Alaba (LB) - 6/10 - Struggled to get involved as an attacking full-back but stout defensively and kept his passing crisp.
Casemiro (DM) - 6/10 - Metronomic and won plenty of duels, but gave the ball away horribly in the build-up to the decisive goal.
Luka Modric (CM) - 5/10 - Tried to get on the ball and didn't have his usual effect on proceedings. Before Casemiro he should have cleared the ball away in the build-up to the goal too, but somehow he slipped.
Toni Kroos (CM) - 5/10 - Booked early for a cynical trip. Sprayed the ball about as usual but didn't have his typical impact. Subbed.
Rodrygo (RW) - 5/10 - Barely involved, in truth. Managed one shot on target and won a few duels. Looked tired after international duty and a lengthy journey.
Marco Asensio (ST) - 5/10 - Probably not a centre-forward. Huffed and puffed but struggled to get involved or create anything.
Vinicius Jr (LW) - 4/10 - Only arrived back from Brazil duty at 3pm on Wednesday and played like he was jet-lagged at times. Strangely dummied when he had a chance to score early on. Did well to wind up the fiery Garcia in a running battle. Subbed.
Eduardo Camavinga (CM) - 5/10
Isco (LW) - 5/10 - Missed a late sitter, but the flag saved him.