This paper designs a terrain-following system based on the real mountain terrain. First, the reference path is generated using the digital map and the path planning algorithm. Then a controller based on receding horizon optimization is designed for simultaneous path following, speed stabilization and constraint handling. The waypoints in the predictive horizon are used as reference input, and the control input is solved in real time by minimizing the tracking error. The simulation results show that compared with the terrain following system based on the adaptive angle guidance, the method in this paper has better performance and can meet the requirements of the terrain following task for subsonic aircraft.