Large-aperture and long focal-length lens is widely used in high energy laser system. The method based on Talbot interferometry is a reliable method to measure the focal length of such elements. By employing divergent beam and two gratings of different periods, this method could realize full-aperture measurement, higher accuracy and better repeatability. However, it does not take into account the spherical aberration of the measured lens resulting in the moiré fringes bending, which will introduce measurement error. Furthermore, in long-focal measurement with divergent beam, this error is an important factor affecting the measurement accuracy. In this paper, we propose a new spherical aberration compensation method, which could significantly reduce the measurement error. Characterized by central-symmetric scanning window, the proposed method is based on the relationship between spherical aberration and the lens aperture. Angle data of moiré fringes in each scanning window is retrieved by Fourier analysis and statistically fitted to estimate a globally optimum value for spherical-aberration-free focal length calculation. Simulation and experiment have been carried out. Compared to the previous work, the proposed method is able to reduce the relative measurement error by 50%. The effect of scanning window size and shift step length on the results is also discussed.