Arturs Zjuzins cancelled out Ronaldo's first-half spot kick to leave the two teams level in the 67th minute, but William Carvalho netted less than two minutes later as Fernando Santos's side regained the lead.
Ronaldo then had his second of the night in the 85th minute, before experienced centre-back Bruno Alves registered two minutes into second-half stoppage time to ensure that Portugal regained second in Group B.
Portugal's first shot on target came in the seventh minute when Joao Mario, who operated in a three-man midfield, struck one from distance, but it was a fairly routine save for Andris Vanins as the home side manage to survive what was an early onslaught.
Ronaldo's first sight of goal came in the 18th minute after working a yard outside the box, but Vanins again showed strong hands between the sticks to keep the score goalless as the first period continued to gather pace.
The home side could well have had three or four in the first period as they continued to dominate, but a brilliant opening 45 minutes from Latvian goalkeeper Vanins kept the score down to 1-0 entering the half-time interval.
Portugal had chances to extend their lead in the opening 10 minutes of the second period, but Ronaldo and Andre Silva both missed the target on a couple of occasions as Latvia stayed in the match approaching the hour mark.
Ronaldo had the opportunity to score his second penalty of the match in the 59th minute after Glebs Kluskins clumsily brought Andre Gomes to the deck, but the 31-year-old hit the inside of the post before Vanins managed to scramble it clear much to the frustration of the Real Madrid forward.
Incredibly, Latvia equalised in the 67th minute of action when substitute Zjuzins smashed the ball into the back of the net from close range, but Portugal regained the lead less than two minutes later courtesy of a close-range header from William Carvalho.
Ronaldo, who could have had four or five, finally netted his second in the 85th minute when he volleyed a Ricardo Quaresma cross into the bottom corner, and it got worse for Latvia in the second minute of additional time when Alves headed a fourth for the home side.
Portugal will continue their qualification campaign with a home match against third-placed Hungary on March 25, while Latvia will travel to Group B leaders Switzerland on the same night.