The development of an analytical method for the determination of Delta(9)-tetrahydrocannabinol (THC), cannabidiol (CBD) and cannabinol (CBN) in samples of human hair is described. Samples were subjected to a procedure based on the combination of headspace solid-phase microextraction (HS-SPME) with gas chromatography linked with mass spectrometry operating in tandem mode (GC-MS/MS). A 10 mg aliquot of sample was firstly decontaminated using petroleum ether, deionized water and dichloromethane (2 mL of each solvent), for 10 min under sonication, and then digested in alkaline solution (1 mol L(-1) NaOH). The method variables evaluated were pH, mass of hair, fiber type, extraction temperature, desorption time, ionic strength, pre-equilibrium time and extraction time. Parameters concerning operation of the tandem mode MS/MS were also assessed and optimized. Validation of the method demonstrated excellent linearity in the range 0.1-8.0 ng mg(-1), with regression coefficients better than 0.994. Precision was determined using two different concentrations (upper and lower limits of the linear range), and RSD values were between 6.6 and 16.4%. Absolute recoveries (measured in triplicate) were in the range 1.1-8.7%, and limits of detection and quantification were 0.007-0.031 ng mg(-1) and 0.012-0.062 ng mg(-1), respectively. The LOQ for THC (0.062 ng mg(-1)) was below the cut-off value (LOQ < or = 0.1 ng mg(-1)) established by the Society of Hair Testing (SOHT), the Society of Toxicological and Forensic Chemistry (STFCh) and the Société Française de Toxicologie Analytique (SFTA). The optimized SPME method was applied in analysis of hair samples from Cannabis drug users, showing that CBN and CBD were present in all samples analyzed.