In what was Nico Estevez's first league game in temporary charge of Valencia, following the exit of Miroslav Djukic on Monday, the hosts showed plenty of character to equalise twice at the Mestalla on Sunday.
However, substitute Jese denied the home side as Real made it seven league games unbeaten on a weekend when title rivals Barcelona and Atletico Madrid both won going into the mid-season break.
A superb solo effort from Angel Di Maria put the visitors ahead after 28 minutes, with the forward darting between Jeremy Mathieu and Juan Bernat before firing home.
Real's lead was cancelled out six minutes later when Pablo Piatti headed the home side level after good work down the left by Bernat.
Cristiano Ronaldo then headed his 18th La Liga goal of the season to restore his side's advantage, but again Valencia hit back, with Mathieu equalising with a header from Dani Parejo's corner just after the hour.
Just when it looked as though Valencia would frustrate Real, Jese popped up with the winner eight minutes from time - his driven effort squirming through Vicente Guaita's hands.
Ancelotti was unable to name Gareth Bale in his Real squad after he suffered a calf injury in training in midweek. The Italian was also without the injured Raphael Varane and the suspended Pepe, with Nacho retaining his place from Real's 2-0 Copa del Rey win over Xativa.
Estevez made four changes from Valencia's 3-0 defeat to Atletico Madrid with goalkeeper Guaita among those brought in. Sergio Canales had to settle for a place on the bench against his former club.
Xabi Alonso came close to connecting with a Marcelo corner at the far post after 16 minutes before Ronaldo flashed a shot wide, as Real enjoyed much of the early pressure.
Real's positive start was rewarded two minutes before the half-hour mark when Di Maria cut inside from the right before beating two Valencia defenders and finding the far corner of Guaita's net.
However, their joy was short-lived as Piatti stole in ahead of Sergio Ramos to head home Bernat's delivery six minutes later.
The goals continued to flow as Di Maria turned provider for Real’s second, supplying a teasing set-piece delivery for Ronaldo to head home unmarked after 40 minutes.
In what was a low-key start to the second half, neither side were able to fashion any clear-cut chances until Mathieu drew Valencia level a minute after the hour mark.
The defender shook off the attentions of Ramos to angle a header past Diego Lopez and register his first goal of the season.
It mattered little, however, as Guaita failed to stop Jese's low strike after 82 minutes, ensuring Ancelotti's men remain five points off La Liga's two frontrunners.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.