The pseudo-spectral method can solve the optimal trajectory of the aircraft with high nonlinear dynamic characteristics in real time. Taking the X-51A similar aircraft model as the research object, the longitudinal aerodynamic model is established by the incremental method and table look-up interpolation. The pseudo-spectral method and the sequential quadratic programming algorithm are used to solve the optimal control problem of gliding trajectory. A multistage iterative optimization strategy is proposed to provide initial values for solving large-scale non-linear programming problems parameterized by pseudo-spectral method, and to compensate for the sensitive initial values and slow convergence of the sequential quadratic programming algorithm in solving large-scale non-linear programming problems. By comparing the state variables and the control variables simulated flight state with the traditional method, the effectiveness and efficiency of the multi-level iterative optimization strategy are proved. The strategy has achieved good results in practical engineering applications.