© Getty Images
The home side could have taken a shock lead in the early moments of the game after Felipe Caicedo burst clear on goal, but under pressure from Sergio Ramos, the Ecuadorian could only force a save out of Keylor Navas.
However, Real went in front after seven minutes through Ronaldo, who latched on to a pass from Luka Modric before applying the finish past the goalkeeper.
The Portuguese star's hat-trick was complete after just 20 minutes when he was in the right place at the right time to convert from close range after a cross from Bale.
Espanyol were shell-shocked, but they nearly pulled a goal back when Salva Sevilla fired an effort on goal, but his shot was gathered at the second attempt by Navas.
Less than 30 minutes were on the clock when Real bagged their fourth thanks to Karim Benzema, who tapped home inside the penalty area after being found by Ronaldo, who had been given acres of space on the left.
With eight minutes of the half remaining, Gerard Moreno fired a shot into the side-netting, but that was as good as it got for the hosts who must try to limit the damage after the break.