Real Madrid produced a stunning comeback from two goals down to beat Villarreal 3-2 on Thursday and book their place in the Spanish Cup quarter-finals.
Elsewhere Barcelona romped to a 5-0 win at third-tier Ceuta with Robert Lewandowski scoring twice.
Carlo Ancelotti's Madrid side will hope the victory is a turning point after struggling in 2023. They were soundly beaten by rivals Barcelona in the Spanish Super Cup final last Sunday.
Los Blancos seemed poised to suffer cup elimination on Thursday, after Etienne Capoue and Samuel Chukwueze struck in the first half for the hosts.
However goals by Vinicius Junior, Eder Militao and Dani Ceballos after the break turned the last-16 clash on its head and sent Madrid, who last won the trophy in 2014, through.
It was another classic comeback for the ages from a team famed for producing them.
"After a very bad first half, the second was different – we pushed, took risks, had courage," Ancelotti told Teledeporte.
"I told them they had to wake up, we had lost a lot of battles, we weren't risking much in the press, they were looking for counters but it was a risk we had to take.
"The team was not well positioned, they were too open, and lacked strength in the duels."
Villarreal, who impressed while beating Madrid in La Liga earlier in January, started brilliantly, Capoue lashing home a stunning strike from Gerard Moreno's flick into his path.
Quique Setien's side had won six of their last seven games and drawn the other and they played with confidence in the first half.
By contrast, Madrid looked chastened after their recent results and the early goal conceded.
The hosts doubled their lead at the Estadio de la Ceramica just before half-time, with Chukwueze providing the finishing touch to a flowing team move.
Ancelotti responded by bringing on Ceballos and Marco Asensio and the changes paid instant dividends, with both players – on the fringes this season – impressing.
Ceballos set up Vinicius to pull the first back for Madrid and it put the wind in their sails.
Asensio drilled a low free-kick under the wall but Filip Jorgensen was equal to it as Los Blancos strained for the equaliser.
The Danish stopper then parried Karim Benzema's header moments later, but Militao pounced on the rebound to level.
With the clock ticking towards extra-time Ceballos struck with a low effort from the edge of the box, set up by Asensio, to complete the rescue mission.
"The team knew how to stay alive in the game and luckily we could turn it around," match-winner Ceballos told Teledeporte.
"We want to dominate matches and lately we have not been capable of doing it, we've had a lot of games in a row, many players coming back from the World Cup, and now we will improve."
Barcelona lifted the Spanish Super Cup in Riyadh with a convincing triumph over Madrid, and after initially struggling to break down Ceuta's defence, eventually cruised to victory.
Lewandowski bagged a brace, while Raphinha, Ansu Fati and Franck Kessie also netted for Barcelona, who have won the Spanish Cup a record 31 times.
Xavi's side took helicopters to Ceuta after flying to Malaga in the morning by jet, just as they did when visiting the North African coast for a Spanish Cup match back in 2010.
"We would like to be able to play at home (in the next round)," said Xavi.
"All the teams are from La Liga, they are strong.
"We'll see what the draw gives us. We're in the last eight, we are happy, we're in a good dynamic — this is the path."
The quarter-final draw takes place on Friday.