Antonio Sanabria headed in a dramatic 94th-minute winner for Betis, who were victorious at the Santiago Bernabeu in a league game for the first time since 1998.
Making his first Liga appearance of the season after serving a five-match domestic ban, Ronaldo was unable to have the same impact he did a week ago when he netted a brace against APOEL in the Champions League.
The Portuguese star tried hard and had numerous attempts on goal, but Madrid failed to score for the first time since April 2016.
The result ended a record-equalling run of 73 games in which Madrid had netted as Zinedine Zidane's men were left seven points behind rivals and league leaders Barcelona.
Zidane made three changes to the starting XI that helped Madrid to a 3-1 win over Real Sociedad last time out, headlined by Ronaldo's return.
Ronaldo started up front in place of Borja Mayoral, while Marcelo also returned from suspension, the Brazilian and Toni Kroos coming in for Theo Hernandez and Marco Asensio.
There were four changes for Betis, who edged Deportivo La Coruna in their previous outing, as Victor Camarasa, Fabian Ruiz, Sanabria and Francis Guerrero started in place of Joaquin, Andres Guardado, Sergio Leon and Juan Jose Narvaez.
Betis made a bright start and only some brilliance from Dani Carvajal denied the visitors an opening goal in the third minute.
Madrid sloppily gave away possession on the halfway line and Betis almost made them pay on the break, Sanabria eventually getting into a position to beat Keylor Navas, only for Carvajal to produce a goal-line clearance.
Ronaldo, quiet in the opening exchanges, almost created something out of nothing at the other end, his audacious back-heel in the 10th minute deflected wide.
Betis midfielder Camarasa had Navas scrambling five minutes later, while Luka Modric hit the side-netting before putting a Carvajal cross just over.
The hosts finally started to look the more dangerous of the teams approaching the half-hour mark, a powerful Ronaldo drive forcing Betis goalkeeper Antonio Adan into a low save.
Carvajal, who endured a mixed half at right-back, gifted the visitors a great chance in the 33rd minute, his poor throw-in finding Ruiz, who forced Navas into a diving save.
Held goalless in the opening half of a league game for the first time since April, Madrid should have gone ahead shortly after the interval, but Ronaldo side-footed a Gareth Bale cross over the bar.
As Ronaldo moved wider, the hosts started to look more dangerous and Carvajal hit the outside of the post after getting on the end of a cross from the Portuguese star in the 55th minute.
Ronaldo was fortunate to escape a sanction for a crude challenge just before the hour-mark and then had penalty appeals turned down as his frustrating outing continued.
Bale, so often criticised by his own fans this season, almost delivered the goal they craved, his delightful flick tipped onto the post by Adan in the 75th minute.
Sanabria had an effort correctly ruled out for offside in the 90th minute, but the forward would soon find a winner.
Left in plenty of space at the back post, the Paraguay international headed in a pinpoint Antonio Barragan cross to give Betis a stunning victory.
Key Opta stats:
- Real Madrid failed to score in a game for the first time since April 26, 2016 – 512 days ago.
- Real Betis won a LaLiga game against Real Madrid at the Santiago Bernabeu for the first time since October 1998.
- Real Madrid failed to win any of their first three home games of a LaLiga season for the first time since 1995-96.
- Only against Malaga in September 2015 (14) has Cristiano Ronaldo attempted more shots without scoring than he had against Betis (12).