Engine efficiency can be maximized by directly measuring in-cylinder parameters and adjusting the spark advance, using a feedback scheme based on the ionization current as sensed variable. Water injection is shown to increase the engine efficiency, if at the same time the spark advance is also changed when water is injected to obtain maximum efficiency. A spark-advance control scheme, that takes the water injection into account, is thus necessary to increase the efficiency.