Holders Real Madrid were helped into Spanish football's King's Cup quarter-finals by a goalkeeping howler from Malaga's Willy Caballero, gifting them a 1-0 away win.
In the 71st minute, the match was goalless and tense with big-spending Malaga, who lost 3-2 at the Bernabeu, needing to score only one to go through on the away goals rule when Real substitute Karim Benzema fired tamely straight at Caballero.
The Argentine keeper had made some impressive saves, but when he fell to his knees to collect, the ball squirmed between his legs and rolled over the line.
Jose Mourinho's men are likely to meet arch-rivals Barcelona in the last eight, with the European and Spanish champions visiting Osasuna on Thursday holding a 4-0 first-leg advantage.
Real will be joined in the quarter-finals by surprise qualifiers Real Mallorca and third tier Mirandes.
Mallorca scored four times in seven minutes during an astonishing comeback to knock out Real Sociedad 6-3 on aggregate earlier in the evening.
The Basques led 2-0 from the first leg in San Sebastian last week and took the lead in Mallorca after 16 minutes, while disgruntled home fans whistled their own side.