In this paper, we propose the usage of an ensemble learning approach for predicting total electron content (TEC). The training data set spans from 2007 to 2016, while the testing data set is set to the year 2017. The model inputs in our study included Solar radio flux (F107), Solar Wind plasma speed, By, Bz, Dst, Ap, AE, day of year, universal time, 30‐day and 90‐day TEC averages. Specifically, eXtreme Gradient Boosting (XGBoost), Gradient Boosting Decision Tree, and Decision Tree were utilized for 1‐hr TEC prediction at high‐ (80°W, 80°N), mid‐ (80°W, 40°N), and low‐ latitudes (80°W, 10°N). Results indicate that all three models performed well in predicting TEC, with a mean error of only approximately 0.6 TECU at high‐ and mid‐ latitudes and 1.13 TECU at low latitudes. At the same time, we compared the model with 1‐day Beijing University of Aeronautics and Astronautics model during the period of magnetic storm from 25 August 2018 to 27 August 2018 and a quiet period from 13 December 2018 to 15 December 2018. In the magnetic storm period, Our model showed an average reduction of 1.83 TECU compared to BUAA model. During the quiet period, XGBoost exhibit an average error that is 1.14 TECU lower than that of BUAA model. Moreover, TEC prediction over the region between the 20°N–45°N and 70°E−120°E during geomagnetic storm has an error of 2.74 TECU, showing the stability and superiority of XGBoost. Overall, the ensemble learning approach exhibits its advantage in predicting TEC.