The control of switched power converters has been mostly accomplished using pulse width modulation (PWM). Under this type of control, it has been shown in literature that DC-AC current mode singlephase inverter may exhibit chaotic behavior if the proportional controller of the PWM modulator is badly tuned. In this work, we present a novel method to control the inverter using an optimal control approach. Our method consists in defining the switching instances in order to achieve the reference current with minimum error. To illustrate the efficiency of our proposed method, numerical simulations and comparison with the proportional and integral controller as well as to the proportional and resonant controller are presented.