MADRID—Real Madrid advanced to a likely Copa del Rey quarterfinal match-up against Barcelona after Malaga goalkeeper Willy Caballero's error gave the defending champions a 1-0 victory on Tuesday.
Caballero's standout performance was spoiled when he tried to hold Karim Benzema's low shot but let it slip through his arms and between his legs in the 72nd minute, sending Madrid through 4-2 on aggregate.
Caballero slammed his hands on the ground in frustration after the goal, which was Benzema's fourth goal in three games and came from his first touch after having replaced Gonzalo Higuain minutes earlier.
The goalkeeper had been unbeatable before that, tipping Cristiano Ronaldo's point-blank header over the bar in the 63rd minute.
"We played an intelligent game tonight. It was a difficult series and we showed a lot of effort to win it," Madrid coach Jose Mourinho said.
Madrid seems certain to face Barcelona in the last eight with the Catalans enjoying a 4-0 lead against Osasuna heading into Thursday's return away leg.
If Barcelona advances, the two-legged series would mean another pair of "clasicos," bringing the total to nine in about nine months. Madrid's sole victory in its past 12 matches against its biggest rival was last season's cup final.
Madrid defender Alvaro Arbeloa was sent off after being booked for the second time in the 88th, and Malaga midfielder Jeremy Toulalan nearly scored from a header two minutes later.
Mourinho said midfielder Sami Khedira was not badly injured despite leaving the game in the first half clutching his right leg.
Also, third-tier team Mirandes scored late to draw 1-1 at Racing Santander and continue its historic run by advancing 3-1 on aggregate. Mallorca rallied to beat Real Sociedad 6-1 to win their series 6-3 overall.
At El Sardinero stadium, Pedro Munitis scored from Alexandros Tzolis' 34th-minute pass to give topflight Santander a chance at rallying from the 2-0 first-leg loss.
But Santander's Bernardo Zuniga was sent off for a second yellow card early in the second half and Pablo Infante, who works in a bank as his day job, scored his fourth goal of the competition from the spot in the 72nd to seal Mirandes' first quarterfinal appearance.
Mallorca looked likely to exit after Sociedad went ahead 3-0 on aggregate following Diego Ifran's 17th-minute opener.
Chori Castro started the improbable comeback by scoring from a free kick in the 34th, before putting the hosts ahead seven minutes later after Israel striker Tomer Mahed and Jose Carlos Nunes had scored.
Alejandro Alfaro and Hemed scored second-half goals for Mallorca.
Mirandes will look to continue its improbable run against Espanyol or Cordoba. Espanyol leads the second-division club 2-1 going into Wednesday's match. Mallorca will play either Athletic Bilbao or third-tier team Albacete after they drew 0-0 to start their series.
Also Wednesday, second-division club Alcorcon leads Levante 2-1. The winner will play Valencia or Sevilla. Valencia leads 1-0.