Ludogorets, a modest provincial club who have only been in existence for 13 years, stunned the 10-time European champions with a sixth-minute strike and threatened throughout despite Ronaldo taking a hand.
The Portuguese star missed one penalty and had a goal disallowed before scoring from a second spot-kick to spare Real's blushes - all in the first 25 minutes.
French striker Karim Benzema made sure Real's reputation remained intact with the winning goal 13 minutes from time.
The home crowd went wild in the sixth minute when the normally-composed Sergio Ramos made a mess of Fabio Espinho's corner and Marcelinho nipped in to head in from two yeards out.
Four minutes later, Luka Modric slid a ball in behind the Bulgarian defence and Yordan Minev mistimed his tackle to concede the penalty, only for Ronaldo's effort to be saved by goalkeeper Vladislav Stoyanov.
On 14 minutes, Ronaldo fired home into the bottom corner, but he was flagged for offside. But he finally made amends 10 minutes later after he was brought down by Alexander Alexandrov and stepped up to knock the penalty home.
Ronaldo could have added a second on 35 minutes but just failed to get a head to Javier Hernandez's cross and had and had another gilt-edged chance early in the second half.