Lucas Vázquez scored with a header in stoppage-time to put Real Madrid back at the top in the Spanish league.
After Girona conceded a late equalizer in its 1-1 draw at Real Betis, Madrid pulled off a 1-0 win on the road against Alaves to reclaim first place after 18 rounds.
Madrid and Girona are tied on 45 points but Madrid was ahead on a tiebreaker. Defending champion Barcelona was third, seven points off the lead. The Catalan club edged last-place Almeria 3-2 at home the day before.
Madrid got the late win despite playing with 10 men from the 54th minute after central defender Nacho Fernández was sent off with a straight red card for a hard foul.
Vázquez was left free inside the area to score the winner with a header after a well-placed corner-kick cross by Toni Kroos.
Jude Bellingham and Rodrygo, the leaders of Madrid's attack this season, were kept in check during most of the match in a lackluster performance by Carlo Ancelotti's team at Mendizorroza Stadium.
Neither team was able to create many significant scoring chances. (AP)