The current stringent regulations have pushed the automotive industry to research on new and complex systems to fulfill the pollutant emission limits while providing a satisfactory fuel efficiency. However, not only an increase on the power plant complexity may affect to the level of emissions but the engine control and the driving behavior as well. These factors will play a key role with the introduction of real-world driving emission tests, where the traditional engine-calibration system could not be the most appropriated tool to develop an engine control system with satisfactory performance in a wide spectrum of driving conditions. The management of engine actuators by means of optimal control techniques is a promising approach that may dramatically help on reducing the level of pollutants in such situations. This work studies the effect of an optimal control strategy on engine fuel efficiency and pollutant emissions. An experimentally validated mean-value control-oriented engine model in combination with a direct optimization method provides the optimal trajectories of engine actuators (fueling rate, exhaust gases recirculation valve position, variable turbine geometry position and start of injection) to cover a predefine route, minimizing fuel consumption with a limitation on NOx emissions. This strategy is validated on a test bench and compared against engine's factory calibration.