In this work, ZnO/PPy nanocomposite coating was fabricated on stainless steel and evaluated as a novel headspace solid phase microextraction (HS-SPME) fiber coating for extraction of ultra-trace amounts of environmental pollutants; namely, aliphatic hydrocarbons in water and soil samples. The ZnO/PPy nanocomposite were prepared by a two-step process including the electrochemical deposition of PPy on the surface of stainless steel in the first step, and the synthesis of ZnO nanorods by hydrothermal process in the pores of PPy matrix in the second step. Porous structure together with ZnO nanorods with the average diameter of 70 nm were observed on the surface by using scanning electron microscopy (SEM). The effective parameters on HS-SPME of hydrocarbons (i.e., extraction temperature, extraction time, desorption temperature, desorption time, salt concentration, and stirring rate) were investigated and optimized by one-variable-at-a-time method. Under optimized conditions (extraction temperature, 65±1°C; extraction time, 15 min; desorption temperature, 250°C; desorption time, 3 min; salt concentration, 10% w/v; and stirring rate, 1200 rpm), the limits of detection (LODs) were found in the range of 0.08-0.5 μg L(-1), whereas the repeatability and fiber-to-fiber reproducibility were in the range 5.4-7.6% and 8.6-10.4%, respectively. Also, the accuracies obtained for the spiked n-alkanes were in the range of 85-108%; indicating the absence of matrix effects in the proposed HS-SPME method. The results obtained in this work suggest that ZnO/PPy can be promising coating materials for future applications of SPME and related sample preparation techniques.