A method and electronic device for optimizing a flight trajectory of an aircraft subject to time of arrival control constraints. The electronic device comprises a communications unit, an optimization module, and an alert generation module. The communications unit receives atmospheric conditions about an aircraft route, aircraft operational constraints and real-time aircraft state and performance. The optimization module receives time of arrival control constraints for the aircraft route and flight trajectory optimization parameters at least including flight cruise altitude. The optimization module comprises a flight trajectory generator that generates sets of values for flight trajectory optimization parameters, computes flight trajectories of the aircraft and selects, based on optimization criteria (e.g. fuel saving, speed control margin), one optimal flight cruise altitude with a computed flight trajectory complying with the time of arrival control constraints. The alert generation module generates trajecto