The Portuguese superstar's opener was cancelled out by Cristhian Stuani's header to see the teams level at half-time.
Two more goals for Ronaldo and one from Lucas Vazquez in the 15 minutes following the break looked to have put Real out of sight, but a second from Stuani 23 minutes from time set up a fascinating finish.
Substitute Gareth Bale clipped home a smart finish for 5-2 with five minutes to go before Juanpe pulled another back for Girona.
But the game was already won, and Ronaldo scored his fourth in stoppage time to add further polish to the result.
The victory sees Real move up into third in the La Liga table, four points back from second-placed Atletico Madrid.
AS provided both lineups ahead of kick-off:
Ronaldo looked in fine touch straight from the off as he forced a decent save from Yassine Bounou in the Girona goal with a free-kick.
Vazquez then should have opened the scoring in the seventh minute but could only fire straight at Bounou after being put through on goal.
Borja Garcia fired a dangerous effort at Keylor Navas soon after before Ronaldo put Real ahead from 12 yards after a smart cutback by Toni Kroos.
Vazquez thought he had doubled Real's lead midway through the first half, but his goal was controversially ruled out for offside, per Marca:
Stuani equalised just before the half-hour mark with a fine stooping header from a free-kick left of the area.
Real went back ahead just after half-time when Ronaldo clipped a fine finish into the back of the net after excellent buildup play from Karim Benzema.
Benzema was again involved in Real's third goal in the 59th minute as he escaped down the left and squared to Ronaldo inside the box, who unselfishly put it on a plate for Vazquez to sweep home.
The Portuguese then showed excellent opportunism to complete his hat-trick from close range after Bounou could only parry Benzema's attempt.
Real switched off slightly as they conceded from another set piece, with Stuani again climbing highest above Dani Carvajal to head home.
Los Blancos looked fairly ragged at the back, but Bale made sure of the points in the 86th minute after being put behind the defence by Luka Modric.
The entertainment continued as Real conceded from another set piece—this time centre-back Juanpe converting from a corner as he rose for a free header.
But more stunning attacking football from Real saw Ronaldo set up for his fourth by Kroos in the dying moments to complete a very satisfying evening's work for the hosts.