Present paper describes optimization of the method of quantitative determination of total petroleum hydrocarbons in soil samples using headspace solid - phase microextraction (SPME) in combination with gas chromatography - mass spectrometry (GC-MS). Effects of moisture content and solvent additives were studied. It was established that an increase of the moisture content in soil leads to an increase of the response of petroleum hydrocarbons reaching its maximum at 15-20% depending on the soil type and concentration of total petroleum hydrocarbons followed by its gradual decrease. For the same concentration of petroleum hydrocarbons, an increase of moisture content in soil from 0 to 20% may lead to a 15x increase of total petroleum hydrocarbons response by solid - phase microextraction. Determination of total petroleum hydrocarbons in soils by SPME -GC-MS without moisture control of samples may lead to large errors, especially at low concentrations. It was established that addition of the solvent to a soil-water mixture allows dissolution of an oil film on the water surface and provides better extraction of hydrocarbons from soil to water phase. To avoid effect of moisture content on the extraction efficiency and more precise analysis of the real samples, addition of the excess distilled water must be done. Addition of the polar organic solvent to a soil-water mixture (10% isopropanol) allows dissolution of an oil film on the water surface and provides linear dependence of extraction efficiency vs total petroleum hydrocarbons content in soil. Testing of the optimized method on model soil samples provided quantitative data, results being in 30-120% range from the real values.