Residues of illicit drugs and their metabolites that are excreted by humans may flow into and through wastewater treatment plants. The aim of this study was to develop a method for the determination of cocaine, amphetamines, morphine, cannabinoids, methadone, and some of their metabolites in wastewater. Composite 24-h samples from urban treatment plants were enriched with deuterated internal standards before solid-phase extraction. High-pressure liquid chromatography tandem mass spectrometry with multiple reaction monitoring was used for quantitation. Recoveries were generally higher than 80%, and limits of quantifications were in the low nanograms-per-liter range for untreated and treated wastewater. The overall variability of the method was lower than 10% for untreated and 5% for treated wastewater. The method was applied to wastewater samples coming from two treatment plants in Italy and Switzerland. Quantification ranges were found to be 0.2-1 microg/L for cocaine and its metabolite benzoylecgonine, 80-200 ng/L for morphine, 10 ng/L for 6-acetylmorphine, 60-90 ng/L for 11-nor-9-carboxy-Delta9-tetrahydrocannabinol, 10-90 ng/L for methadone and its main metabolite 2-ethylidene-1,5-dimethyl-3,3-diphenylpyrrolidine, and lower than 20 ng/L for amphetamines. As previously reported for cocaine, this method could be useful to estimate and monitor drug consumption in the population in real time, helping social scientists and authorities to combat drug abuse.