The feasibility of direct (ie, without sample preparation) quantitative analysis of total hydrocarbons and water in oil-contaminated soils using mid-infrared spectroscopy and an attenuated total reflection (ATR) probe has been investigated. Spectral characteristics of unpolluted and oil-contaminated soils composed of sand, clay, dolomite, and humus have been studied over the full mid-infrared range (4000-400 cm). Spectra of 25 typical soil samples containing varying levels of oil and water have been analyzed using a chalcogenide infrared fiber-based probe with a ZrO 2 crystal as an ATR element. The spectral data were used to build calibration models for the analysis of hydrocarbon contamination as well as moisture content of soil samples. The low quality of ATR spectra of drier samples and variable spectral intensity inherent in the ATR measurement of solids has been overcome by suitable data processing. Further improvement of the model performance has been achieved using a variable selection based on the modified genetic algorithm. Our proposed method allows the determination of oil and moisture content in soils with accuracies of 1.1% and 0.6%, respectively, which is sufficient for a number of practical applications. The reported results may be used to develop portable devices for measuring petroleum and water content of soils.