Juve climbed into third place on 69 points, level with Atalanta in second and AC Milan in fourth, but two points ahead of fifth-placed Napoli.
The visiting defence was caught napping when Udinese wing back Nahuel Molina latched onto a quickly taken freekick to fire home the opener after 10 minutes.
But Rodrigo De Paul stuck out an arm to block a Ronaldo freekick with seven minutes remaining and the Portuguese converted the resulting penalty to end his run of three games without a goal.
Ronaldo then headed in an 89th-minute winner from close range to take his tally to the season to a league-high 27 Serie A goals in 30 appearances.
(Reporting by Alasdair Mackenzie; Editing by Christian Radnedge)
Photo Juventus FC Twitter