The brace from the teenage Brazilian striker helped earn a hard-fought 5-2 win over Celta on Thursday, with the match at one stage poised for a penalty shootout.
Strikers Kylian Mbappe and Vinicius Jr scored a goal in each half to give Real a 2-0 lead.
Celta, however, levelled matters with late goals from Jonathan Bamba and Marcos Alonso that took the match into extra time.
As the game looked destined for a penalty shootout, 18-year-old substitute Endrick worked his magic to give the lead back to the hosts after shooting from the edge of the box in the 108th minute.
Four minutes later teammate Federico Valverde unleashed a thunderous strike from long range into the top corner to extend their lead, with Endrick wrapping up the win with a brilliant back-heel flick in the 119th minute.
Real Sociedad and Osasuna also progressed on the night to the last eight.
Sociedad beat 10-man Rayo Vallecano 3-1 with goals from Mikel Oyarzabal (23rd), Jon Ander Olasagasti (45+1) and Sergio Gomez (79th).
Oscar Trejo scored a penalty late in the first half for the visitors, who had Alfonso Espino sent from the field in the 77th minute.
Osasuna went through by beating Athletic Club 3-2, with Ante Budimir converting a 70th-minute penalty to separate the teams.