In this work, we present a new mechanism for designing phase-gradient metasurfaces (PGMs) to control an electromagnetic wavefront with high efficiency. Specifically, we design a transmission-type PGM, formed by a periodic subwavelength metallic slit array filled with identical dielectrics of different heights. It is found that when Fabry–Pérot (FP) resonances occur locally inside the dielectric regions, in addition to the common phenomenon of complete transmission, the transmitted phase differences between two adjacent slits are exactly the same, being a nonzero constant. These local FP resonances ensure total phase shift across a supercell, fully covering a range of 0 to 2π, satisfying the design requirements of PGMs. Further research reveals that, due to local FP resonances, there is a one-to-one correspondence between the phase difference and the permittivity of the filled dielectric. A similar approach can be extended to the reflection-type case and other wavefront transformations, creating new opportunities for wave manipulation.