Young substitute Alvaro Morata earned Real Madrid a near-farcical win at a waterlogged Estadi Ciutat de Valencia.
Cristiano Ronaldo fired Real into a first-half lead but Angel Rodriguez, on as a substitute early in the second half, equalised in the 62nd minute.
Xabi Alonso missed a penalty but then delivered the free-kick for Morata, who had only been on the pitch for two minutes after replacing Mesut Ozil, to head the winner.
The match was contested in almost unplayable conditions, with the ball barely bouncing or rolling on the sodden surface.
Ronaldo required treatment in the third minute when he was caught by David Navarro's elbow, leaving him with a nasty cut above his left eye.
Papakouli Diop and Juanlu both shot wide for Levante in the opening stages, while Alonso was also off target with Real's first effort.
Ronaldo was booked for handball but put his side ahead brilliantly in the 21st minute. Alonso's free-kick from deep was not cleared by Navarro, his header dropping to Ronaldo who controlled the ball well on his thigh before volleying into the roof of the net.
Jose Barkero curled a Levante free-kick over and Alonso's effort at the other end was blocked by Vicente Iborra.
Ronaldo was withdrawn at half-time, Raul Albiol taking his place.
And Levante almost equalised immediately after the restart as Juanlu let fly from 25 yards, forcing Iker Casillas to dive full-length and palm the ball around the post.
The Spain goalkeeper was tested from distance once more by Barkero's left-foot curler as the hosts made an excellent start to the half, but coach Juan Ignacio Martinez had seen enough and sent Angel on in place of Nabil El Zhar.
Real centre-halves Pepe and Sergio Ramos hit the crossbar within two minutes of each other from Angel Di Maria corners, the former with a towering header and Ramos when his backheel from a yard hit Diop and bounced up onto the woodwork.
Di Maria poked wide when well placed and Real were made to pay for their misses when Barkero's pass was flicked on by Obafemi Martins and splashed down at the feet of Angel, who benefited from a marginal onside call and finished from a narrow angle.
Real were awarded a contentious penalty in the 71st minute. Navarro's foul on Jose Callejon appeared to be just outside the box, so Levante - and particularly Juanfran, who was booked for his protests - will feel Gustavo Munua's save from Alonso's poor effort saw justice done.
Juanlu clipped a left-foot shot just wide but 20-year-old Morata made the decisive contribution six minutes from time when he was left unmarked six yards out to nod in Alonso's left-wing delivery.
Martins beat the offside trap but could not get round Casillas and, off balance, blazed his shot into the stand as Levante were edged out.
Real remain third, five points behind city rivals Atletico and eight adrift of Barcelona.