A numerical technique for solving the classical brachistochrone problem in the calculus of variations is presented. The brachistochrone problem is first formulated as a nonlinear optimal control problem. Application of this method results in the transformation of differential and integral expressions into some algebraic equations to which Newton-type methods can be applied. The method is general, and yields accurate results.