Real Madrid travelled to Cordoba on Saturday knowing that a win would move them four points clear at the top of La Liga.
Nabil Ghilas sent the home side into an early lead from the penalty spot, but Karim Benzema levelled for Los Blancos three minutes before the 30-minute mark.
Real Madrid's task got harder in the final 10 minutes when Cristiano Ronaldo was sent off, but the visitors had a late penalty when Fede Cartabia handled inside the area, which saw the Spaniard also given his marching orders.
Gareth Bale stepped up to score the spot kick and secure all the points for Real Madrid.
Read how it all unfolded in Sports Mole's minute-by-minute live commentary of the action below.
CORDOBA: Carlos; Gunino, Pantic, Crespo, Edimar; Deivid, Rossi; Bebe, Fede, Ghilas; Florin
REAL: Casillas; Carvajal, Varane, Ramos, Marcelo; Khedira, Kroos, James; Bale, Benzema, Ronaldo