Copa del Rey Review: Goals rain in Spain
Valencia, Barca, Almeria and Celta de Vigo all progressed to the round of 16 with 24 goals scored across the four matches.
In Valencia, Rayo looked on track to triumph when they led 4-2 on the night and 5-4 on aggregate with just under 30 minutes remaining but goals from Paco Alcacer and Rodrigo saw the hosts win 6-5 over the two legs.
An own goal from Rayo defender Morcillo just after the break had dragged the tie to 4-4 - although the visitors led on away goals - and Adri Embarba's fine finish in the 61st minute put the Madrid-based club further on top.
Valencia had entered the contest with just one win in their past five league games but were able to turn their poor form around in the cup competition.
A driving counterattack saw Alcacer score in the 65th minute - the 21-year-old striker notching his brace after scoring the opening goal - while Rodrigo struck the winner with 19 minutes left in controversial circumstances.
Alcacer challenged Rayo goalkeeper Cristian Alvarez in the air, making contact with the gloveman, but the referee ignored the visitors' pleas for a foul, as Rodrigo smashed his volley into the net.
A much-changed Barcelona thrashed Segunda B leaders Huesca 8-1 to complete a 12-1 aggregate victory.
Pedro was the star for Luis Enrique's side - with Lionel Messi, Neymar and Luis Suarez all left out of the squad - with the 27-year-old scoring a hat-trick.
The speedster put Barcelona on their way with goals in the 20th and 26th minutes, before Sergi Roberto and Andres Iniesta got on the scoresheet.
There was still time for Pedro to seal a first-half hat-trick in the 43rd minute, while Adriano Correia, Adama Traore and Sandro Ramirez all netted after the interval.
Huesca managed one goal in the 86th minute through Carlos Moreno.
In the other two ties, Almeria won 2-1 at home to defeat Real Betis 6-4 on aggregate, while Celta claimed their first win in seven games in all competitions, winning 4-1 against second-tier Las Palmas to progress 4-3 on aggregate.