Introduction Effective cation exchange capacity (ECEC) is a key indicator of soil fertility and sustainable soil management assessment in coffee-growing systems. Methods This study aimed to identify the principal edaphic and altitudinal factors explaining ECEC variability in 69 soil samples collected from coffee farms in northeastern Peru. Results ECEC results exhibited substantial variation, ranging from 0.14 to 55.49 cmol(+)·kg −1 (mean = 15.21; SD = 12.47), and were significantly correlated with organic matter (r = 0.71), clay content (r = 0.62), exchangeable acidity (r = –0.63), and altitude (r = 0.33). Principal component analysis accounted for 64.3% of the edaphic variability, identifying Ca 2+ , pH, Mg 2+ , and exchangeable acidity as the most influential variables. The Random Forest model demonstrated high predictive accuracy (R 2 = 0.93; root mean square error (RMSE) = 2.1 cmol (+)·kg −1 ), outperforming the generalized additive model (GAM) and identifying Ca 2+ as the most important predictor (IncMSE% = 3177.37). A functional altitudinal gradient was also evident: areas above 1150 m.a.s.l. showed higher acidity and aluminium content, whereas areas below 900 m.a.s.l. exhibited greater base saturation and higher ECEC. Discussion These findings support the development of sitespecific fertilization strategies and soil–climate zoning, emphasizing the value of integrating multivariate analyses with machine-learning models as key tools for optimizing fertility management and coffee crop productivity in tropical mountain ecosystems; where soil texture represents a key factor influencing coffee sustainability, as greater nutrient retention capacity and improved nutritional balance are associated with enhanced potential for sustainable production and reduced environmental impact.
Díaz-Chuquizuta et al. (Tue,) studied this question.