The visitors took the lead just 12 minutes into the tie when a cross fell for Jaime Romero, who headed in from point-blank range.
However, Alaves were handed a lifeline when Jagoba Beobide was brought down in the box, allowing Borja Viguera to level the scores from the penalty spot, calmly slotting his kick past Fernando Pacheco.
Jiri Jarosik tried to give the home side the lead 10 minutes later as he looked to head in from an Ion Velez delivery, but the danger was cleared.
Castilla capitalised on the miss just the break as Romero tried to force the ball in following a corner, but Manu Garcia got the final touch, turning the ball into his own net.
Alaves kept pressing after the break, and were level again when Viguera claimed his second goal of the match, this time volleying it in from the edge of the box.
The hosts faced a tough task for the final 20 minutes as they were reduced to 10 men when Oscar Serrano was shown a straight red for arguing with the referee.
Castilla couldn't make the most of their man advantage, however, as Alaves held on to gain a point that puts them five from safety.