An optimal control approach for minimizing metallurgical length deviation during casting speed increase under constraints on the secondary cooling flow rates for continuous steel casting process is proposed. The process is described as a single-phase Stefan problem. The temperature and the shell growth are controlled by the steel surface heat flux generated by the cooling sprays. A cost function reflecting the error in tracking of a reference shell thickness is chosen, and the control objective is formulated as the minimization of this cost function under the spray rate constraints. Finding the control law satisfying this objective is formulated as a two-step procedure. First, an analytical setting for the cost function minimization is established through deriving the corresponding direct, adjoint, and sensitivity systems. Then, a computational procedure for solving this analytical setting, which finds the actual control law, is given. A numerical example presents the application of the method proposed. The results are then extended to a 2D model, with the corresponding numerical example provided.