In this paper, optimal gliding trajectories are analyzed, formulating an optimal control problem to be solved computationally via nonlinear programming. A multi-objective terminal cost function that minimizes the velocity, altitude, horizontal flight path angle, and the error of a desired terminal point is formulated. The results are validated via Monte Carlo simulations, analyzing the influence of the variations in the lift-to-drag ratios in the atmospheric entry. The results show feasible solutions for minimizing the distance to the desired final point, which have significant practical implications for the controlled gliding entry of a spaceplane on Mars. In this sense, the results also show that the longitudes of the landing points do not change too much for almost all trajectories, while the latitude of these points is in the interval of about 4 degrees for the majority of the trajectories. This suggests that it is possible to implement an optimal control approach with reasonable accuracy for the controlled gliding entry of a spaceplane on Mars, even in the presence of some uncertainties regarding the aerodynamic performance of the spacecraft, such as the lift-to-drag ratio.