Karim Benzema struck deep into stoppage time as Real Madrid set a new Spanish record by extending their unbeaten run to 40 games in a thrilling 3-3 draw at Sevilla to progress to the Copa del Rey quarter-finals on Thursday.
Holding a 3-0 first leg lead, a Cristiano Ronaldo-less Real looked set for defeat for the first time in eight months as an own goal from Danilo and second-half strikes from Stefan Jovetic and Vicente Iborra saw Sevilla lead 3-1 inside the final 10 minutes.
However, Sergio Ramos's penalty and substitute Benzema salvaged Madrid's run, which now surpasses the 39-game unbeaten run set by Barcelona last season.
"Possibly they deserved to win the game, but we fought until the end," Real boss Zinedine Zidane told GolTV.
"They deserved more tonight, but the tie is two games and (over the two legs) it is logical that we go through."
Both coaches named weakened sides with one eye on Sunday's crunch top of the table La Liga clash between the two back at the Sanchez Pizjuan.
However, it was Sevilla who settled first as they forced Madrid onto the back foot from the off.
"We had a lot of chances, at least 15 against a team of the stature of Madrid," said Sevilla coach Jorge Sampaoli.
"We were very close. Unfortunately, we couldn't take our chances to show the difference there was between the teams."
Kiko Casilla had already been forced into two saves from Sergio Escudero and Joaquin Correa before Danilo powered a header into his own net after just 10 minutes.
In the absence of Ronaldo and Benzema, Mariano Diaz was handed a rare start up front and nearly levelled in bizarre fashion as Sevilla 'keeper David Soria's clearance ricocheted off the striker and inches wide.
However, most of the action in the first-half came at the other end as Casilla saved three times in quick succession from Wissam Ben Yedder and Luciano Vietto to prevent Real falling further behind.
Toni Kroos fired inches wide just before the break, but the vital away goal the visitors needed to kill off the tie arrived in spectacular fashion three minutes into the second-half.
Marco Asensio pounced on a clearance from a Sevilla corner on the edge of his own area and ran the length of the field barely challenged before slotting below Soria.
That left Sevilla needing an unlikely four more goals to qualify, but they continued to pour forward as on-loan Inter Milan forward Jovetic marked his debut by volleying home Escudero's cross six minutes later.
Sampaoli threw on frist-team regulars Samir Nasri and Vitolo in search of more goals.
And Madrid's record run appeared to be over when Iborra forced the ball home from close range to make it 3-1 with just 13 minutes remaining.
However, Casemiro was adjudged to have been pushed inside the area by Matias Kranevitter five minutes later.
Against his former club, Ramos showed remarkable calm to chip the resulting spot-kick down the middle of the goal.
And Benzema provided the final sting in the tale three minutes into added time when he saw off two tired Sevilla challenges before firing low past Soria to seal a 6-3 aggregate win.
Earlier, Celta Vigo and Eibar completed their progress into the last eight having already built-up three-goal first leg leads over Valencia and Osasuna respectively.
They will be joined by Atletico Madrid, Barcelona, Alaves, Alcorcon and Real Sociedad in Friday's draw.
By AFP's Kieran Canning