New methodologies have been developed to optimize EGR rate and injection timing in diesel engines, with the aim of minimizing fuel consumption (FC) and NOx engine-out emissions.The approach entails the application of a recently developed control-oriented engine model, which includes the simulation of the heat release rate, of the in-cylinder pressure and brake torque, as well as of the NOx emission levels. The engine model was coupled with a C-class vehicle model, in order to derive the engine speed and torque demand for several driving cycles, including the NEDC, FTP, AUDC, ARDC and AMDC.The optimization process was based on the minimization of a target function, which takes into account FC and NOx emission levels. The selected control variables of the problem are the injection timing of the main pulse and the position of the EGR valve, which have been considered as the most influential engine parameters on both fuel consumption and NOx emissions. The gear number has also been selected for optimization.One benchmark tool, which is based on the dynamic programming technique, and one real-time tool, which implements a static optimization method, have been developed for the optimization process. A new mathematical technique has been introduced and applied in order to decrease the computational time of the optimizers to a great extent.It was verified that the real-time method has the potential of being implemented in the engine control unit (ECU), in order to realize an onboard optimization of the selected engine and vehicle parameters.