Madrid had taken an early lead at the Benito Villamarin on Sunday thanks to a fine drive scored by Ballon d’Or winner Luka Modric.
But Sergio Canales hit back with a goal that survived a lengthy VAR review to seemingly claim a point for Quique Setien’s side.
Former Betis star Ceballos had other ideas, though, coming off the bench to net a 20-yard free-kick with two minutes to go to move Madrid up to fourth.
Madrid started well and they took the lead in the 13th minute, Modric blasting a drive into the top-left corner from just outside the penalty area.
Vinicius Junior fired straight at Pau Lopez at the end of a flowing move as Madrid kicked through the gears, Antonio Barragan making a wonderful challenge to halt another rapid break.
Canales recorded the first Betis shot on target two minutes into the second half but Keylor Navas, deputising for the injured Thibaut Courtois, got everything behind the shot.
Navas was beaten in the 67th minute, however, the impressive Giovani Lo Celso sending Canales clear of the Madrid defence to squeeze his shot through the goalkeeper and over the line.
The goal was subject to a lengthy VAR review, giving the home fans an agonising wait, but replays showed Dani Carvajal was playing Canales onside and the goal stood.
Solari ignored Isco as he used his last two subs to bring on Ceballos and Brahim Diaz for his LaLiga debut, with the decision justified in the 88th minute.
What does it mean? Injuries mount for struggling Solari
Ceballos justifies Solari faith
Bringing on Ceballos instead of Isco appeared a curious move and a decision Solari seemed certain to have to defend in his post-match news conference. But the former Betis midfielder settled the contest with a beautifully hit free-kick, earning Madrid an important three points.