The relative position of mask and wafer can be reflected by the variation of the spatial phase in the alignment method basing on spatial phase of fringe pattern, through spatial phase imaging of grating modulation. The relative displacement of mask and wafer can be obtained from spatial phase demodulation of fringe patterns to carry out the alignment process. Generally, the windowed Fourier transform (WFT) is representative method for spatial phase demodulation of the fringe pattern. It is robust and accurate, but it is computational redundant for the alignment of nanolithography. This paper presents a phase demodulation method which has good accuracy and can be carried out in real time to meet the need of the alignment of nanolithography. This method is improved on the basis of the traditional WFT. The fast Fourier transform (FFT) is introduced to WFT and the phase is computed by integrating the phase gradient which is extracted directly from the fringe pattern through generation of the adaptive windowed Fourier elements. These two improvements can individually reduce the computation time for spatial phase demodulation of fringe pattern. The theoretical background and the principle of the algorithm of fringe pattern analysis are proposed. Numeric computation indicate that this method is of high accuracy and computational efficient for fringe pattern analysis, which show high significance for application of alignment of nanolithography.