Fringe projection is a non-contact optical method that is widely used in the optical precision measurement of complex stepped surfaces. However, the accuracy of the fringe phase extraction employed has a direct impact on the measurement precision of the surface shape. Where phase-shifting measurement is used, the classical equal step phase extraction algorithm can only be used to measure simple and smooth surfaces, and leads to measurement errors on complex stepped surfaces, which affects the accuracy of the phase extraction. In addition, the iterative process lasts for a long time, resulting in a low efficiency. This paper proposes a step-by-step phase-shifting extraction algorithm based on selective sampling to measure the contour of the stepped surface. Firstly, the fringe pattern is sampled at equal intervals to reduce the iterative calculation time. Finally, the accurate measurement phase is calculated by the alternating iteration method. The phase extraction accuracy and iteration times are compared in experimental measurements between classical iterative algorithms such as four-step phase-shifting algorithms and the variable phase shift phase interpolation algorithm based on selective sampling. It is shown that the variable frequency phase-shifting extraction algorithm based on selective sampling has a shorter operation time, smaller error, and higher accuracy than the traditional iterative algorithm in fringe projection measuring complex stepped surfaces.