As it is well known one of the most harmful emissions in SI engines is NOx and there are several ways to minimize NOx emission. Internal exhaust gas recirculation (IGR) is an effective way to control and minimize NOx concentration in exhaust gas. In this paper, a method for minimizing NOx emission by use of IGR and variable valve timing (VVT) is introduced. In this method, formation of NOx is controlled by mass fraction of residual gas (RG) and mass fraction of RG is controlled by variable timing of exhaust valves opening and closing so not only the timing of exhaust valves changes but also the lift profile of exhaust valves is variable. In this paper, first a thermodynamic model of a SI engine was developed and validated by experimental data. The model was a reliable tool for predicting engine performance and emission characteristics. The effect of variable exhaust valve timing on RG mass fraction, NOx formation and brake specific fuel consumption was investigated. Then a multi-objective genetic algorithm (NSGA II) was applied to find the optimum timing and lift duration of exhaust valve.