In this paper, a new method is proposed to design optimized control fields with desired temporal and/or spectral properties. The method is based on penalizing the difference between an optimized field obtained from an iterative scheme and a reference field with desired temporal and/or spectral properties. Compared with the standard optimal control theory, the current method allows a simple, experimentally accessible field be found on the fly; while compared with parameter space searching optimization, the iterative nature of this method allows automatic exploration of the intrinsic mechanism of the population transfer. The method is illustrated by examing the optimal control of vibrational excitation of the Cl–O bondwith both temporally and spectrally restricted pulses.