First moment spot centroid calculation in a sliding window with a threshold is proposed. The global centroid is computed in the image first. At this center a certain size window is used,and then the centroid again is calculated. Whether the difference value of the two adjacent centroids meets the given centroid convergence condition is estimated,if not the window slides to the new centroid position and the centroid again is computed until convergent. Compare the method with the traditional first moment centroid calculation method under different system conditions on the calculation accuracy,the simulation and experiment results show that the method is of higher calculation accuracy which can be used in the high precision adaptive optics system.