Traditional e-sales forecasting models for e-commerce platforms face challenges such as handling complex nonlinear data relationships, a lack of personalized marketing strategies, and low utilization of real-time data, resulting in poor forecasting accuracy. To address these issues, this paper explores a machine learning–based approach to sales forecasting, with the aim of improving forecast accuracy and enabling personalized marketing plans. The study uses a public dataset from an e-commerce sales forecasting challenge, performs data preprocessing, and removes outliers and missing values. An e-commerce sales forecasting model is then built using the eXtreme Gradient Boosting algorithm, which can effectively capture nonlinear relationships in the data and generate more accurate sales forecasts. In addition, the K-means clustering algorithm is used to analyze customer data to support the development of personalized marketing strategies.