Madrid weathered Espanyol's initial push and turned to Karim Benzema and Ronaldo to provide the attacking threat. Ronaldo scuffed Benzema's pass in the 18th before drawing two awkward saves from Casilla with a powerful strike in the 31st and a dipping free kick in the 37th.
Espanyol, which was without suspended forward Sergio Garcia and coach Javier Aguirre, was fortunate to make it to halftime not trailing after Angel Di Maria squandered Madrid's four-on-two counterattack seconds before Benzema headed wide in the 42nd.
But Pepe made good on Madrid's dominance by thumping Modric's pass under Casilla, who got a hand on the ball but not enough to keep it out of his net.
Ronaldo had two more great looks to increase his impressive tally this season, but Casilla bettered him one-on-one in the 82nd before saving Benzema's shot in the 89th and watching Ronaldo fire the rebound wide with the goalmouth beckoning.
Nothing went Betis' way against Osasuna, a direct relegation rival, in a game both sides finished with 10 men.
Betis conceded Roberto Torres' header within two minutes, had Jose "Nono" Delgado dismissed with his second yellow card in the 38th, and saw Jordi Figueras score an own goal in the 57th.
And when Osasuna goalkeeper Andres Fernandez gave them a sliver of hope in the 62nd when he was red carded for fouling Ruben Castro in the area, Castro deflated the crowd at Benito Villamarin Stadium by sending his penalty kick off the crossbar.
Jorge Molina pulled one back in the 80th but Osasuna had two opportunities to widen the margin before the final whistle.
The demoralizing loss left Betis winless in its last 12 league matches and seven points from safety.
"We took a step backward today," said Betis coach Juan Carlos Garrido. "I won't deny it. It was important to win today, and besides, clearly our first half of the season was very poor. There has to be a radical turnaround in every facet for us to remain in the first division."
Osasuna stayed unbeaten in four rounds and edged five points clear of the drop.
Rayo's win at Getafe still left it in the relegation zone.
Forward Alberto Bueno scored what proved to be the winner in the 29th after Alejandro Galvez was quick to cross a rebounded shot.
Levante climbed past Malaga into the middle of the standings.