The victory over Valencia, which had won three straight in the league, moved Madrid from sixth to fifth in the standings, three points behind leader Sevilla and two points behind second-place Barcelona.
Sevilla visits fourth-place Alaves on Sunday, while Barcelona hosts Villarreal. Third-place Atletico Madrid, two points off the lead, visits Girona.
Valencia lost at Juventus 1-0 in the Champions League on Tuesday, a result that ended its chances of advancing from the group stage. Madrid won at Roma 2-0 to advance.
"We played well in Rome and again today," coach Santiago Solari said. "Credit to the players."
Playing at Santiago Bernabeu Stadium for the first time after four straight away games, Madrid was loudly cheered by fans after the match, despite a lackluster second half.
"I want us to play more as we did in the first half," Solari said. "In the second half things changed because Valencia needed to equalize and took more risks."
Madrid started well and opened the scoring less than 10 minutes in with an own-goal by Daniel Wass while trying to clear a cross from Dani Carvajal to Karim Benzema. The French striker set up Lucas Vazquez's 83rd-minute goal from close range to seal the victory.
There were some jeers for Gareth Bale after another mediocre display when he was substituted for Marco Asensio in the second half. Luka Modric also was replaced, by Federico Valverde.
Francisco "Isco" Alarcon, out of favor with Solari, entered the match in the 80th to a loud ovation from the crowd.
Valencia dropped to 13th in the standings.
"We played great in the second half," Valencia coach Marcelino Garcia Toral said. "I wouldn't say the result wasn't fair, but we had our chances to earn a draw."