New technological developments are helping to control contaminants in diesel engines but, as new degrees of freedom become available, the assessment of optimal values that combine to reduce different emissions has become a difficult task. This paper studies the feasibility of using artificial neural networks (ANNs) as models to be integrated in the optimization of diesel engine settings, with the objective of complying with the increasingly stringent emission regulations while also keeping, or even reducing, the fuel consumption. A large database of stationary engine tests covering a wide range of experimental conditions was used for the development of the ANN models. The optimization was developed within the frame of the European legislation for heavy duty diesel engines. Experimental validation of the optimized results was carried out and compared with the ANN predictions, showing a high level of accuracy, especially for fuel consumption and nitrogen oxides (NOx).