Real Madrid travelled to Levante on Saturday needing the three points to stay in touch with Barcelona and Atletico Madrid at the top of La Liga.
Both sides had their moments in an entertaining first period, but the score remained level at the interval.
Baba Diawara sent Levante into the lead in the early stages of the second half, but Sergio Ramos headed Real Madrid level moments later.
Levante moved ahead five minutes from time courtesy of a strike from Nabil El Zhar, but the scoring was not over as Alvaro Morata put Madrid level, before Cristiano Ronaldo won it in the fourth minute of additional time.
Read how it all unfolded in Sports Mole's minute-by-minute live commentary of the action below.
LEVANTE XI: Navas; Navarro, Juanfran, Lopez, Rodas; Diop, Simao, Xumetra, Garcia; Ivanschitz, Diawara
REAL MADRID XI: Lopez; Arbeloa, Varane, Ramos, Coentrao; Khedira, Modric; Ronaldo, Isco, Di Maria; Benzema