Zinedine Zidane's side nearly made the game safe when Cristiano Ronaldo's drive cannoned back off the post, though up the other end, Alaves were also denied by the woodwork, Alfonso hitting the frame of the goal from distance.
Also Saturday, Real Madrid visits Alaves while Athletic Bilbao is at Malaga.
The home side brought on Alfonso Pedraza for the final 25 minutes, and the former Leeds United winger nearly made an instant impact, only for his volley from the edge of the box to deflect onto Keylor's crossbar via Raphael Varane.
Alaves looked set to extend Madrid's patchy start to the season when captain Manu Garcia equalised before the break, but Ceballos quickly responded with his second to help secure just a third win in six league matches. Just three minutes after the equaliser, Ceballos struck again, with Pacheco failing to clear the initial chance. Starting from the efforts of Marco Asensio, the ball fed into the middle of the penalty box. Ceballos used his strength to muscle Ely off the ball before side-footing his 20-yard effort into the bottom left-hand corner.
Alaves, who came into the goal without a point or a goal this season, equalised through Manu Garcia's header.
Real Madrid boss Zinedine Zidane has no concerns over Cristiano Ronaldo's form despite the forward failing to score for a second straight match on Saturday.
Pedraza hit the Real Madrid woodwork for the second time in the 76th minute following a mistake from Varane, and a late goal or two appeared certain with both defences looking shaky in the second period.
But the Alaves substitute's stab under Navas bounced away off the frame of the goal again and Madrid escaped with the points.