This paper investigates the combustion phasing control of natural gas-diesel engines. In this study, the combustion phasing is influenced by manipulating the start and the duration of the diesel injection. Instead of using both degrees of freedom to control the center of combustion only, we propose a method that simultaneously controls the combustion phasing and minimizes the amount of diesel used. Minimizing the amount of diesel while keeping the center of combustion at a constant value is formulated as an optimization problem with an equality constraint. A combination of feedback control and extremum seeking is used to solve this optimization problem online. The necessity to separate the different time scales is discussed and a structure is proposed that facilitates this separation for this specific example. The proposed method is validated by experiments on a test bench.