In this paper, an accurate method is proposed for wavelength calibration in grating spectrometers. The analytical calibration model of the Czerny–Turner optical system, which describes the relationship between the wavelengths and the pixel numbers with function of the system parameters, is established on the basis of the grating equation and geometric optics. An optimization fitting algorithm is introduced to calculate the practical system parameter values in this model. Experimental tests are conducted in our manufactured spectrometer. The results show that this method has higher calibration accuracy in a broadband spectrometer system and less dependence on the spectral lines chosen compared to the traditional polynomial method. This novel wavelength calibration method also can be applied to other plane-grating or concave-grating spectrometers.