A method is presented for predicting total phosphorus concentration in soils from Santander de Quilichao, Colombia, using a UV-VIS V-750 Spectrophotometer and machine learning techniques. A total of 152 soil samples, prepared with varying proportions of P2O5 fertilizer and soil, were analyzed, obtaining reflectance spectra in the 200 to 900 nm range with 3501 wavelengths. Additionally, 152 laboratory results of total phosphorus concentration were used to train the prediction model. The spectra were filtered using a Savitzky-Golay filter. Key wavelengths were identified using Variable Importance in Projection - Partial Least Squares (VIP-PLS) and Random Forest (RF), reducing the spectral bands to 1085. Principal Component Analysis (PCA) further reduced data dimensionality. A feedforward artificial neural network was then trained to predict phosphorus concentration. This method is faster than traditional lab tests by leveraging advanced data analysis and machine learning, offering results in less time. While sample preparation remains consistent with standard spectroscopic analysis, the value added by the proposed method lies in its data processing and interpretation. Currently applied to a single soil type, future improvements will include more soil types and other macronutrients, enhancing nutrient management in agriculture. Accurate macronutrient measurements aid in better fertilizer uses planning.• Filtering spectra and determining relevant wavelengths using VIP-PLS and RF.• Dimensionality reduction with PCA.• Training feedforward artificial neural networks.