The reigning Spanish champions had gone ahead in the first half when Karim Benzema also opened his account in the division but Getafe levelled in controversial circumstances through Jorge Molina, who looked offside when he struck nine minutes into the second half.
After that Ronaldo, whose five previous goals this term had come in the Champions League or Spanish Super Cup, somehow prodded wide from close range only to make amends with the winner in the 85th minute.
Sevilla suffered an eighth successive league defeat at Athletic Bilbao to see their hopes of turning the heat up on La Liga leaders Barcelona dashed.
With Barca facing unbeaten Atletico Madrid in the capital on Saturday evening, second-placed Sevilla could have cut the gap on the pacesetters to two points with victory at San Mames in the early kick-off.
However, Sevilla have not picked up a single point from their trips to Athletic since 2009 and, despite the home side languishing in mid-table and without a win in six competitive matches, it was the Basque outfit who emerged victorious.
That was thanks to Mikel Vesga's goal before half-time, with the midfielder coolly lofting his shot over Sergio Rico after Raul Garcia's attempted shot had deflected into his path just yards out.