Nolito fired the hosts into an early lead before goals from Toni Kroos and Hernandez turned the game around yesterday.
Santi Mina brought Celta level, but James Rodriguez's deflected effort put Madrid in front once more before the break and Hernandez rounded off the scoring in style 22 minutes from time.
"It was the kind of game we like," said Real boss Carlo Ancelotti.
"To play on the front foot and take risks as did Celta. That made for a spectacular and very open game.
More From This Section
Hernandez had starred with the only goal of the tie as Real beat Atletico Madrid for the first time in eight meetings this season to reach the Champions League semi-finals in midweek.
However, they were pushed onto the back foot straight away by a Celta side that had already claimed the scalps of Barcelona and Atletico in La Liga this season.
Nolito opened the scoring after just nine minutes as he eased past the weak challenges of Dani Carvajal and Asier Illarramendi before leaving Iker Casillas flat-footed with a low shot that rolled in at the near post.
The visitors then went in front as Hernandez's scoring streak continued with a fine low finish after a neat one-two with Rodriguez.
Yet, again the lead was short-lived when Fabio Orellana's through ball split the Madrid defence wide open and Mina slotted into an empty net at the second attempt after his initial effort came back off the post.