Vinicius Junior sent Los Blancos ahead in the 70th minute of the contest, but Girona levelled the scores in the 80th minute through Cristhian Stuani, who registered from the penalty spot.
Carlo Ancelotti's side have moved one point clear of Barcelona in the table despite dropping points for just the second time in the league during the 2022-23 campaign.
Rodrygo proved to be the home side's biggest threat in the first period, with the Brazilian drawing a smart save from Girona goalkeeper Paulo Gazzaniga in the 10th minute before hitting the post in the 24th minute.
Girona were enjoying themselves at Bernabeu, though, and the visitors rattled the crossbar through Yangel Herrera in the 38th minute, with the two teams heading down the tunnel at 0-0.
Real Madrid were struggling to carve out clear opportunities, but the champions took the lead in the 70th minute through Vinicius, who turned a low cross from Federico Valverde into the back of the net.
Marco Asensio then tested Gazzaniga with a drive in the 72nd minute, but the former was penalised for a handball inside his own box in the 79th minute, and Stuani stepped up to send his penalty past Thibaut Courtois.
There were nine minutes added at the end of the 90, and Rodrygo thought that he had won it in the final minute, but the Brazilian's goal was disallowed for a foul.
A frustrating afternoon for Real Madrid ended with them a man down, meanwhile, as Toni Kroos picked up a red card for a second bookable offence in stoppage time.