This paper studies nonlinear finite-horizon optimal control problems with terminal constraints, where all nonlinear functions are rational or algebraic functions. We first extend a recursive elimination method, which decouples the Euler-Lagrange equations into sets of algebraic equations, where each set contains only the variables at the same time instant. Therefore, a candidate of an optimal feedback control law at each time instant is obtained by solving each set of algebraic equations. Next, we provide a sufficient condition such that each set of algebraic equations gives a unique local optimal feedback control law at each time instant. Illustrative and practical examples are provided to illustrate the proposed method and sufficient condition.