This paper addresses the trajectory tracking control problem for underactuated VTOL UAVs. According to the different actuation mechanisms, the most common UAV platforms can achieve only a partial decoupling of attitude and position tasks. Since position tracking is of utmost importance for applications involving aerial vehicles, we propose a control scheme in which position tracking is the primary objective. To this end, this work introduces the concept of attitude planner, a dynamical system through which the desired attitude reference is processed to guarantee the satisfaction of the primary objective: the attitude tracking task is considered as a secondary objective which can be realized as long as the desired trajectory satisfies specific trackability conditions. Two numerical simulations are performed by applying the proposed control law to a hexacopter with and without tilted propellers, which accounts for unmodeled dynamics and external disturbances not included in the control design model.