A theory for obtaining a waveform for the effective entrainment of a weakly forced oscillator is presented. Phase model analysis is combined with calculus of variation to derive a waveform with which entrainment of an oscillator is achieved with a minimum power forcing signal. Optimal waveforms are calculated from the phase response curve and a solution to a balancing condition. The theory is tested in chemical entrainment experiments in which oscillations close to and farther away from a Hopf bifurcation exhibited sinusoidal and higher harmonic nontrivial optimal waveforms, respectively.