Shaped pulses obtained by optimal control theory often possess unphysically broad spectra. In principle, the spectral width of a pulse can be restricted by an additional constraint in the optimization functional. However, it has so far been impossible to impose spectral constraints while strictly guaranteeing monotonic convergence. Here, we show that Krotov's method allows for simultaneously imposing temporal and spectral constraints without perturbing monotonic convergence, provided the constraints can be expressed as positive semi-definite quadratic forms. The optimized field is given by an integral equation which can be solved efficiently using the method of degenerate kernels. We demonstrate that Gaussian filters suppress undesired frequency components in the control of non-resonant two-photon absorption.