The most accurate star centroiding method for star sensors is the Gaussian fitting (GF) algorithm, because the intensity distribution of a star spot conforms to the Gaussian function, but the computational complexity of GF is too high for real-time applications. In this paper, we develop the fast Gaussian fitting method (FGF), which approximates the solution of the GF in a closed-form, thus significantly speeding up the GF algorithm. Based on the fast Gaussian fitting method, a novel star centroiding algorithm is proposed, which sequentially performs the FGF twice to calculate the star centroid: the first FGF step roughly calculates the Gaussian parameters of a star spot and the noise intensity of each pixel; subsequently the second FGF accurately calculates the star centroid utilizing the noise intensity provided in the first step. In this way, the proposed algorithm achieves both high accuracy and high efficiency. Both simulated star images and star sensor images are used to verify the performance of the algorithm. Experimental results show that the accuracy of the proposed algorithm is almost the same as the GF algorithm, higher than most existing centroiding algorithms, meanwhile, the proposed algorithm is about 15 times faster than the GF algorithm, making it suitable for real-time applications.