Malaga left it late to overcome Segunda Division side Eibar 4-1 and reach the Copa del Rey quarter-finals after a drawn first leg.
The Primera Division and Champions League outfit trailed for over an hour after Ruben Arroyo's 12th-minute goal put Eibar 2-1 up on aggregate, only drawing level in the 74th minute through Diego Buonanotte.
Seba Fernandez and Francisco Portillo then put them ahead and, after Eibar had substitute Guille Roldan sent off, Buonanotte scored again in added time to wrap up a 5-2 aggregate success.
Valencia also advanced to the last eight, beating Osasuna 2-1 at the Mestalla to complete a 4-1 aggregate win.
Tino Costa added to Los Che's first-leg advantage in the 36th minute and though Joseba Llorente responded within a minute, there was no way back for Osasuna and Roberto Soldado's last-minute goal rubbed salt in their wounds.