Accurate prediction of the Ecological Risk Index (ERI) is critical for urban sustainability but is often hindered by the “spatial blindness” of standard machine learning (ML) models, which ignore the spatial dependence inherent in remote sensing data. To address this, we propose GeoXGBoost, a lightweight framework that incorporates spatial econometric principles into gradient boosting. By integrating a row-normalized spatial weight matrix (W), the model generates spatial-lag features to explicitly learn neighborhood interactions. Validation mainly uses Bengbu City, China, as the empirical sample (N = 2,847 grid units): GeoXGBoost improves the non-spatial XGBoost baseline, reducing RMSE from 0.004146 to 0.003998 and increasing R2 from 0.8123 to 0.8255 under the random split. Repeated K-fold metrics support the stability of the gain. The framework further maintains improved performance under stratified spatial cross-validation, providing a more conservative indication of spatial generalization than random splitting. Furthermore, SHAP-based interpretation suggests that the model helps decouple local drivers from spatial spillovers, revealing a threshold-like nonlinear response of governance-related distances rather than a single certified policy threshold.