We present a new design for the integration of a tunable Fabry-Perot (FP) filter and the grating etched on top of the cavity (IGFP) in the miniature spectrometer. It is based on the predispersion of the grating with the capacity of spatial separation of the spectral component and filter effect of the tunable FP filter. The free spectral range (FSR) of the IGFP is determined by the FSR of the grating, and its resolution depends on the filtering capacity of the FP filter. In the experiment, the high-resolution and wavelength scanning process of the IGFP were demonstrated with a narrowband and broadband light source, respectively. The results of the sub-nanometer resolution agree well with those from a commercial optical spectrum analyzer. Further, the IGFP provides an effective approach to solve the problem of the decrease of spectral resolution in the miniaturization process.