Holders Barcelona were knocked out of the Copa del Rey after suffering a 3-2 defeat in extra-time at Athletic Bilbao in the last 16 on Thursday.
Athletic went ahead early thanks to a beautiful cross-shot from Iker Muniain who curled the ball past Marc-Andre ter Stegen into the top corner.
Former Manchester City forward Ferran Torres equalised for Barca with a brilliant right-foot strike from the edge of the area – his first goal for the club.
Inigo Martinez put Athletic back in front after 86 minutes, winning a challenge against Gerard Pique to score, but Pedri netted a fine goal in stoppage time to send the game into extra-time.
Man-of-the-match Muniain scored the winner from the penalty spot after the video assistant referee spotted a handball from Jordi Alba inside the area.
10-man Real Madrid overcame a hostile atmosphere and fought back from a goal down in extra-time to beat Elche 2-1 and reach the Copa del Rey quarter-finals.
Following a scoreless 90 minutes, Elche took the lead with a free-kick earned with Real down to 10 men after Marcelo was sent off for a foul on Tete Morente.
Experienced defender Gonzalo Verdu struck the free-kick into the wall but his second effort deflected off Dani Ceballos wrong-footed goalkeeper Andriy Lunin before ending up in the back of the net.
Real grabbed the equaliser when Isco deflected a Ceballos shot inside the box and substitute Eden Hazard scored the winner on a counter-attack after receiving a through ball from David Alaba, rounding the goalkeeper and finishing into an empty net.
The match ended in controversy as Elche found the net in the last minute of extra-time, but the referee disallowed the effort for a foul in the build-up.
Real Madrid joined Bilbao, Real Sociedad, Valencia, Real Betis, Rayo Vallecano, Mallorca and Cadiz in the quarter-finals.
Meanwhile, in La Liga, Getafe eased their relegation fears with a 4-2 win over Granada.
Sandro Ramirez fired Getafe ahead with a low drive from the edge of the area after 10 minutes, but moments later Luis Suarez swept in an equaliser from close range.
Enes Unai lashed Getafe ahead from a tight angle two minutes after half-time and Nemanja Maksimovic tucked in the third just after the hour.
Suarez pulled another back for the visitors but Borja Mayoral wrapped up the victory with three minutes left.