Real Madrid travelled to Elche on Wednesday looking to record their fifth win of the La Liga season.
Both sides had opportunities in the first period, but neither could make the breakthrough with the score level at the interval.
Cristiano Ronaldo broke the deadlock in the early stages of the second period, however, when his free kick squeezed into the bottom corner.
Elche found an equaliser in stoppage time when Richmond Boakye headed home from close range, but a penalty from Ronaldo in the 96th minute secured all the points for the capital outfit.
Read how it all unfolded in Sports Mole's minute-by-minute live commentary of the action below.
ELCHE: Herrera; Lomban, Suarez, Albacar, Botia; Sanchez, Marquez, Perez; Manu, Coro, Gil
REAL MADRID: Lopez; Arbeloa, Pepe, Ramos, Coentrao; Khedira, Modric; Di Maria, Isco Ronaldo; Benzema