Bayern's Arturo Vidal opened the scoring and missed a penalty before Ronaldo volleyed the equaliser in the 47th minute and scored the winner 13 minutes from time when he was picked out by Marco Asenio and finished calmly.
Bayern, who had won their last 16 home games in the competition since losing to Real in April 2014, started strongly and took the lead when Vidal met Thiago Alcantara's corner with a thumping header in the 25th minute.
Vidal could have given the host a two-goal cushion from the spot in first-half stoppage time following Dani Carvajal's handball, but stepping up in place of injured striker Robert Lewandowski he blazed the penalty over the bar.
Bayern goalkeeper Manuel Neuer denied Ronaldo and Gareth Bale with fine stops and the tie firmly swung in Real's favour in the 61st minute when Javi Martinez was sent off following two quick-fire yellow cards.
Real took control after Martinez's dismissal and could have extended their lead when captain Sergio Ramos headed into the net in stoppage time, only for the effort to be ruled out for offside.
The result left Bayern with much to do in the second leg on Tuesday, while Real remained on course in their bid to become the first side to retain the Champions League crown.
[caption id="attachment_57877" align="aligncenter" width="640"]
Ronaldo became the first ever player to net 100 times in Uefa competitions REUTERS
"We would have preferred to have scored another goal," Real coach Zinedine Zidane told French TV. "We had the opportunity.
"We've won the first match, the second is still to come," he added. "We're content with the result, but we'd have liked to have scored more."
"We were in total control during the first half but we weren't subsequently able to exploit the spaces," Bayern's Philipp Lahm told German TV. "The red card was the neckbreaker."
"We're still alive, we're not dead," added Bayern coach Carlo Ancelotti. "Real have the better chance now but we still have a chance too, and we'll play with everything we've got."