A compact broadband Compton spectrometer is designed to measure the continuous spectrum of gamma-ray sources driven by an intense laser. The incident gamma rays are converted into electrons in low-Z materials by Compton scattering. Produced by a pair of stepped magnets, a weaker-front–stronger-rear nonuniform magnetic field in the electron magnetic spectrometer is used to spectrally resolve the scattered electrons, leading to a broadband gamma-ray spectral coverage of 2–20 MeV in a compact volume. Flat imaging-plate detectors are placed near the focused imaging points of the magnetic spectrometer to record the dispersed electrons, thereby achieving an optimal spectral resolution of 6%–13% in the energy range of 3–20 MeV. The spectrometer is used successfully to measure the gamma-ray spectrum generated by the high-energy electron beams produced by a femtosecond-laser-driven wakefield.