For many control applications, identifying an optimal operating point by maximizing/minimizing a performance function is important. This paper applies the extremum-seeking method to nonaffine, nonlinear discrete-time systems stabilized by an optimal adaptive controller. First, a novel averaging method is used for the nonlinear discrete-time systems to show that their output unique extrema are stable equilibrium points. Then, a singular perturbation method in discrete time is employed to show that the overall closed loop system will dynamically converge to the extremum. The applicability of this scheme is numerically verified on a Homogeneous Charge Compression Ignition (HCCI) model validated experimentally and expressed as an uncertain nonaffine, nonlinear discrete-time dynamic system. This proposed method is able to find an operating point that not only maximizes the engine's efficiency, but also maintains the pressure rise rate (PRR) within the engine's operating limits.