Gareth Bale created two goals on his return from injury as Real Madrid avoided an embarrassing defeat by third-tier club Fuenlebrada in the Copa del Rey.
The Wales forward, 28, came off the bench after two months out with calf and thigh problems to create two goals for Borja Mayoral in the 2-2 second-leg tie.
Real manager Zinedine Zidane’s second-string side were trailing at the Santiago Bernabeu before Bale’s introduction.
The former Tottenham star helped make it 2-1 on the night but Fuenlabrada substitute Alvaro Portilla salvaged a draw in the 89th.
A 2-0 lead from the first leg meant 19-time cup winners Real progressed to the last 16 on aggregate.
The visiting side from the suburbs of the Spanish capital had taken the lead through midfielder Luis Milla in the 25th minute, with a long-range shot that beat Real goalkeeper Keylor Navas.
But Bale picked up the ball after coming on and curled over a cross for Mayoral to head an equaliser in the 63rd minute.
He then skipped into the area to force goalkeeper Pol Freixanet to parry and Mayoral picked up the loose ball to score again.