Antonio Sanabria sent Betis into a 25th-minute lead in the Spanish capital, but Cristiano Ronaldo levelled the scores five minutes before the break, before Sergio Ramos headed Real Madrid's winner late on.
Real Madrid boss Zinedine Zidane made four changes to the team that started against Napoli in the Champions League on Tuesday night, with Nacho, Isco, James Rodriguez and Alvaro Morata replacing Pepe, Casemiro, Gareth Bale and Karim Benzema.
Real Madrid's first serious chance of the night arrived in the seventh minute when Morata broke into the Betis box, but instead of shooting, the Spaniard looked for a cross into Ronaldo and the Portuguese fired over the crossbar from a narrow angle.
James was next to try his luck for Real Madrid from distance, but Betis goalkeeper Antonio Adan was on hand to make a smart save, before Isco whistled a powerful strike wide of the post two minutes later.
Betis's first attempt on target followed soon as Castro found a yard of space in a forward position before having a go, but Real Madrid stopper Keylor Navas was on hand to make the stop during an end-to-end period of the match.
There was big controversy in the 22nd minute when Betis midfielder Darko Brasanac broke through into a one-on-one situation with Navas before going down under a late challenge from the Costa Rican international, but the referee was not interested, despite replays indicating that the goalkeeper should have received his marching orders for the last-man challenge.
Navas was then involved in the opening goal of the night three minutes later as the Real Madrid stopper somehow spilled a low strike from Sanabria over the goal-line after initially seeming to deal with the number nine's tame effort.
The response from Real Madrid was strong, however, and the home side levelled the scores five minutes before the interval when Ronaldo headed a Marcelo cross past Adan after being afforded too much space inside the Betis box.
Betis had a half-chance to regain the lead early in the second period when Aissa Mandi met a high ball inside the Real Madrid box, but the centre-back's header was kept out by a smart stop from Navas, who faced whistles from sections of the Bernabeu support after his error in the first half.
The away side had another opportunity in the 59th minute when Ceballos danced past Marcelo before picking out Castro with a low cross, but the experienced striker could only fire his effort into the stands.
It took Real Madrid until the hour to register their first shot on target in the second period, but Luka Modric's long-range strike proved comfortable for Adan, who would have expected to have been busier at the start of the second 45 minutes.
Lucas Vazquez for James was Real Madrid's first change of the night 20 minutes from time, while Benzema joined the action soon after as Morata, who struggled to make his mark, was replaced by the Frenchman.
Ronaldo had the ball in the back of the Betis net for a second time in the 73rd minute, but the offside flag was raised against the Portuguese, despite replays showing that the forward was level with Betis's final line of defence.
The visitors were reduced to 10 men in the 78th minute when Cristiano Piccini was handed a second yellow card for pulling Lucas outside the Betis box, although the wing-back did prevent what might have been a tap-in for Ronaldo at the far post.
Real Madrid continued to press, however, and scored their second in the 81st minute when Ramos headed a Toni Kroos corner past Adan to make it three goals in one week for the centre-back.
Betis managed to put the home side under some pressure in the latter stages and came close to a leveller through a Sanabria header in stoppage time, but Real Madrid held on to secure a vital victory on a weekend where Barcelona and Sevilla both dropped points.
Next up for Zidane's side is a trip to Athletic Bilbao next weekend, while Betis will attempt to return to winning ways when they host basement side Osasuna.body check tags ::