Troy Parrott's late goal ended Real Madrid's perfect start to the LaLiga season, with the Republic of Ireland striker scoring nine minutes from time before Real Betis goalkeeper Alvaro Valles saved a stoppage-time penalty from Kylian Mbappe.
Parrott, introduced in the 68th minute, broke the deadlock in the 81st when he reacted quickly after Madrid goalkeeper Thibaut Courtois parried a header into his path. Mbappe struck the crossbar four minutes later before substitute Carlos Espi had a spectacular bicycle kick ruled out for offside following a VAR review.
Madrid got one final opportunity when Natan brought down Vinicius Junior inside the area deep into stoppage time, but Valles saved Mbappe's spot kick to preserve Betis's lead and secure the three points.
Jose Mourinho, who lost his first game since returning as Real Madrid manager, said: "I don't know how we lost because we played very well collectively. I cannot fault the attitude of any of my players. We deserved to win but deserving to win does not give you points."