Juventus trailed after Emre Can put through his own net early in the second-half.
With his side devoid of imagination and losing, Juve boss Massimo Allegri brought on the attack minded Federico Bernardeschi for the defensive midfielder Blaise Matuidi.
Allegri tweaked his configuration again on 70 minutes with Joao Cancelo replacing Douglas Costa.
And it was the two substitutes who were involved in restoring parity. Bernardeschi left two defenders in his wake as he scorched down the left wing.
He passed to Paulo Dybala whose shot was parried by the Lazio goalkeeper Thomas Strakosh. Cancelo, returning from a six week injury lay-off, slotted in the rebound.
The 24-year-old Portugal international then earned the penalty which Ronaldo thrashed home with two minutes remaining.
"For sixty minutes it was the worst Juventus of the year," said Juve skipper Giorgio Chiellini. "Paradoxically after the goal disadvantage we found the motivation to win it."
Lazio drop to eighth place - three points off the Champions League spots - after their second consecutive league defeat.