Rapid analysis of oil-contaminated soils is important to facilitate risk assessment and remediation decision-making process. This study reports on the potential of a handheld midinfrared (MIR) spectrometer for the prediction of total petroleum hydrocarbons (TPH), including aliphatic (alkanes) and polycyclic aromatic hydrocarbons (PAH) in limited number of fresh soil samples. Partial least squares regression (PLSR) and random forest (RF) modelling techniques were compared for the prediction of alkanes, PAH, and TPH concentrations in soil samples (n = 85) collected from three contaminated sites located in the Niger Delta, Southern Nigeria. Results revealed that prediction of RF models outperformed the PLSR with coefficient of determination (R 2) values of 0.80, 0.79 and 0.72, residual prediction deviation (RPD) values of 2.35, 1.96, and 2.72, and root mean square error of prediction (RMSEP) values of 63.80, 83.0 and 65.88 mg kg-1 for TPH, alkanes, and PAH, respectively. Considering the limited dataset used in the independent validation (18 samples), accurate predictions were achieved with RF for PAH and TPH, while the prediction for alkanes was less accurate. Therefore, results suggest that RF