In this paper, an endoatmospheric ascent optimal guidance law with terminal constraint is proposed, which is under the framework of predictor-corrector algorithm. Firstly, a precise analytical nonlinear trajectory prediction with arbitrary Angle of Attack (AOA) profile is derived. This derivation process is divided into two steps. The first step is to derive the analytical trajectory with zero AOA using a regular perturbation method. The other step is to employ pseudospectral collocation scheme and regular perturbation method to solve the increment equation so as to derive the analytical solution with arbitrary AOA profile. The increment equation is formulated by Taylor expansion around the trajectory with zero AOA which remains the second order increment terms. Therefore, the resulting analytical solutions are the nonlinear functions of high order terms of arbitrary AOA values discretized in Chebyshev-Gauss-Legendre points, which has high accuracy. Secondly, an iterative correction scheme using analytical gradient is proposed to solve the endoatmospheric ascent optimal guidance problem, in which the dynamical constraint is enforced by the resulting analytical solutions. It only takes a fraction of a second to get the guidance command. Nominal simulations, Monte Carlo simulations, and optimality verification are carried out to test the performance of the proposed guidance law. The results show that it not only performs well in providing the optimal guidance command, but also has great applicability, high guidance accuracy and computational efficiency. Moreover, it has great robustness even in large dispersions and uncertainties.