Mercury and its compounds, especially methyl mercury(MeHg) and ethyl mercury(EtHg), are ubiquitous in the environment. It is necessary to the determinate mercury species due to their high toxicity and biomagnification. A novel method is described for the Hg analysis in soil and sediment samples in this study. Samples were extracted with alkaline(KOH/CH3OH), MeHg and EtHg in the extraction solution are derived by sodium tetrapropyl boride to generate volatile methylpropyl mercury and ethylpropyl mercury. After purging and trapping, thermal desorption and gas chromatography separation, Hg compounds were cracked into mercury vapor at high temperature,and finally detected by atomic fluorescence spectrometer, qualitative according to retention time and quantitative with external standard method. Pretreatment and instrumental parameters were optimized in detail. The recoveries of MeHg and EtHg were 83.0%-109% and 90.3%- 96.5%, respectively. The recoveries of the certified standard materials were higher than 90.0%,and the relative standard deviation were less than 1.0%. The method was finally applied to the real samples of black, red and fluvo-aquic soils. The recoveries of MeHg and EtHg were 85.1%-109% and 90.3%-96.3% with the RSDs less than 6.0%. This method was fast and accurate, which could be applied to the analysis of large quantities of samples. After properly adjusting the pretreatment method, this method could also be applied to the analysis of alkyl mercury in environmental organisms (such as fish, shellfish), atmospheric particles and other samples, which hinted its wide application range and promising application prospect.