Ronaldo, who had previously netted eight braces in Madrid colours but never gone on to claim a treble, struck in the 26th, 57th and 72nd minutes to cancel out Aritz Aduriz's early opener for Mallorca.
Gonzalo Higuain then added a late fourth for Madrid, putting the Argentinian on 26 for the season - one ahead of team-mate Ronaldo and five behind Barcelona's Lionel Messi at the top of the scoring charts.
Real coach Manuel Pellegrini said: "Cristiano is a major figure in this Real Madrid side and we spent two months without him. Nevertheless, we made a team and without him the other players still won games. I would have liked to have seen Barcelona go two months without [Lionel] Messi."