We developed a technique to simultaneously measure self-phase modulation and two-photon absorption using shaped femtosecond laser pulses. In the conventional Z-scan measurement technique the amount of nonlinearity is determined by measuring the change in shape and intensity of a transmitted laser beam. In contrast, our method sensitively measures nonlinearity-induced changes in the pulse spectrum. In this work we demonstrate the technique in nonlinear absorptive and dispersive samples, quantify the obtained signal, and compare the measurements with traditional Z-scans. This technique is capable of measuring these nonlinearities in highly scattering samples.