We present a spectrometer setup based on grating dispersion for hard x-ray free-electron lasers. This setup consists of a focusing spectrometer grating and a charge-integrating microstrip detector. Measurement results acquired at Linac Coherent Light Source are presented, demonstrating noninvasive monitoring of single-shot spectra with a resolution of 2.0×10(-4) ±0.3×10(-4) at photon energy of 6 keV with more than 95% transmission of the main beam.