The substitute Jesé fired home a late winner to earn Real Madrid a 3-2 win over battling Valencia that keeps them within five points of the Primera Division pace-setters.

Jesé found a gap between the Valencia goalkeeper, Vicente Guaita, and his near post with eight minutes left to give Madrid victory in a match which saw the managerless home side twice fight back from a goal down.

Angel Di María (28th minute) and Cristiano Ronaldo (40) had put the visitors ahead but Valencia had levelled both times through headers from Pablo Piatti (34) and Jérémy Mathieu (62).

The hosts, who were being led by the youth-team coach Nico Estévez after Monday's departure of Miroslav Djukic, could not find a third equaliser following Jesé's goal, though, as Madrid kept up the pressure on the top two, Barcelona and Atlético Madrid.

Di María netted the opener with a superb effort just before the half-hour, the Argentina winger bringing down a crossfield pass from Marcelo before skipping between two defenders and curling a shot just inside the far post.

Valencia were behind for six minutes before Piatti drew them level when he got on the end of Juan Bernat's cross to glance home a header from six yards.

Madrid refused to be deflated and Di María drew a fine save out of Guaita soon after, before Ronaldo restored the lead when he headed home the winger's free-kick unchallenged from near the penalty spot.

That left Madrid ahead at the break but once again Carlo Ancelotti's men failed to hold on to their lead as they were undone by another header when Valencia made it 2-2 just after the hour. Piatti swung over a corner from the left and Mathieu climbed above Sergio Ramos in the box to power a header above Lopez and into the net.

Valencia's defence was breached for a third time in the closing stages after an error in judgment from Guaita, and this time there was no way back for Los Che.

Luka Modric won the ball back on the edge of the Valencia box and fed the unmarked Jesé on the right side of the area. The angle looked too tight for the 20-year-old but he tried his luck and was rewarded when his shot sneaked past Guaita and into the net for the matchwinner.