Optical sparse aperture imaging systems require a very accurate control of the phase errors between sub-apertures to achieve high-resolution. The linearized analytic phase diversity (LAPD) is a fast technique to co-phase sparse aperture imaging systems. However, it requires focal plane and out-of-focus images to achieve phase diversity, so the light path is complex. In this Letter, we propose a spatially modulated analytic phase diversity algorithm. The diversity images are obtained by the spatial modulation diversity technology (SMDT). The validity of the method was verified by simulation experiments. The method can typically detect piston errors within |π/2| rad rms in the extended target scenes. Co-phase accuracy can be achieved by iterating up to λ/60. The method does not require additional splitting device, which is conducive to system miniaturization, while the required calculations are simple and the piston detection is fast. This method can give a simple, fast and low system complexity solution for fine phasing of sparse aperture imaging systems under any imaging scenes.