In this paper an algorithm for the trajectory tracking of a three-dimensional trajectory, assigned as a function of time, is presented. The proposed control system is suitable for application on unmanned aerial vehicles (UAVs) or for aircraft that require accurate path tracking, as in the case of rotorcraft in nap-of-the-earth (NOE) flight conditions. The control system logic features (i) an external loop based on a simple guidance scheme and a two-time-scale inverse simulation algorithm, and (ii) an inner loop, based on a linear-quadratic (LQ) full-state-feedback controller. In this way the control action is split into two contributions, i.e. a feedforward command, in order to follow the trajectory generated by the guidance scheme, and a feedback increment, for compensating external disturbances and model uncertainties. A rotorcraft model is used to demonstrate the algorithm capability in a NOE–like flight task. System robustness is analysed and control system performance are discussed in terms of the error between vehicle state and desired trajectory at a given time. Simulation of a representative manoeuvre shows that the feedforward estimate of the control action is accurate and only minor compensation is required from the LQ tracker. The algorithm is suitable for a number of applications, as (i) no simplifying assumptions are postulated for the model, (ii) there are no restrictions on the flight condition, and (iii) the computational time should allow for real–time implementation.