We demonstrate the ultrafast coherent control of a nonlinear two-photon absorption in a dynamically shifted energy level structure. We use a spectrotemporal laser-pulse shaping that is programed to preserve the resonant absorption condition during the intense laser-field interaction. Experiments carried out in the strong-field regime of two-photon absorption in the ground state of atomic cesium reveal that the analytically obtained offset and curvature of a laser spectrum compensate the effect of both static and dynamic energy shifts of the given light-atom interaction.