In this study, a method for the determination of triclosan (TCS) and methyl triclosan (MTCS) in soil and sewage sludge samples from municipal wastewater treatment plants was developed based on the extraction by matrix solid-phase dispersion. After extraction, the analytes were derivatized with N-(tert-butyldimethylsilyl)-N-methyl-trifluoroacetamide for their determination by isotope dilution GC with electron impact MS detection in the SIM mode, using 13C12-labeled compounds as internal standards. Recoveries of MTCS and TCS from laboratory spiked sludge samples were in the range from 95.7 to 101.0% and 97.4 to 101.3%, respectively. In the case of soil samples, the recoveries of MTCS and TCS ranged from 98.4 to 101.0% and 98.7 to 99.0%, respectively. The limits of detection (S/N=3) varied from 0.10 to 0.12 ng/g for sewage sludge samples and from 0.05 to 0.08 ng/g for soil samples. The validated method was used to assess the levels of TCS and MTCS in sewage sludge collected from 19 wastewater treatment plants located in Madrid (Spain) and in soil samples collected from agricultural fields in Madrid. Both compounds were detected in all the sludge samples at concentrations ranging from 54 to 2987 ng/g dry weight for TCS and from 4 to 311 ng/g dry weight for MTCS. The levels encountered in soil were much lower, 0.8 to 4.7 ng/g dry weight for TCS and 0.3 to 3.8 ng/g dry weight for MTCS.