
The result sees Real drop to second in the standings on 33 points, one behind leaders Barcelona.
Villarreal sit third with 32 points, while Atletico Madrid are fourth on 31, with only three points separating the top four teams.
Girona scored the opener just before the break when Viktor Tsygankov led a rapid counter-attack down the right channel.
The Ukrainian delivered a pinpoint low cross to Ounahi, who fired a thunderous strike into the top corner from just inside the box, leaving Thibaut Courtois with no chance.
Madrid’s persistence eventually paid off in the 67th minute.
Vinicius Jr’s mazy run from the left led to a foul inside the box, earning the visitors a penalty.
Mbappe stepped up to calmly slot his effort into the bottom-left corner, narrowly beyond the reach of Paulo Gazzaniga.