Celta de Vigo will meet Real Madrid in the Copa del Rey round of 16 after beating Almeria in extra-time on Thursday.
Enrique de Lucas' 109th-minute goal secured a 3-0 win for Celta, who eliminated Almeria 3-2 on aggregate.
Almeria, who won the opening leg of the tie 2-0, looked set to advance in the tournament despite a goal from Celta forward Park Chu-Young in the 55th minute.
But the second-tier club were unable to hold on for a showdown with Madrid as Roberto Lago struck in the dying stages to extend the contest.
The match seemed headed for a penalty shootout until de Lucas received Andres Tunez's through-ball and rounded the goalkeeper before calmly finding the net from an angle.
Elsewhere, 10-man Real Zaragoza ousted Granada on the away goals rule after losing 2-1 to advance 2-2 on aggregate.
Nigerian forward Odion Ighalo opened the scoring for Granada in the 27th minute before Zaragoza midfielder Jose Maria Martin struck what proved to be the decisive away goal on 55 minutes.
Zaragoza midfielder Helder Postiga was sent off for a second bookable offence in the 59th minute, and a goal from Diego Mainz seven minutes later renewed hope for the hosts.
Granada fought gallantly in search of a goal but failed to find a way past Zaragoza goalkeeper Leo Franco.
Zaragoza will face Levante in the round of 16.
Finally, Mallorca accounted for Deportivo de La Coruna on the away goals rule following a 0-0 draw to progress 1-1 on aggregate.
Mallorca will take on Sevilla in the next round.