When cocaine is smoked, methylecgonidine (anhydroecgonine methyl ester) is also consumed as a pyrolytic product. Methylecgonidine, on incubation with human liver homogenate, was metabolized to a stable compound, ecgonidine. The compound was also formed when methylecgonidine was exposed to a urine pH > or = 8.0. Ecgonidine is a zwitterion and highly water soluble. A method was developed to identify ecgonidine quantitatively in urine. After removal of cocaine, benzoylecgonine and methylecgonidine from urine at pH 5.5 +/- 0.5 using a solid-phase extraction (SPE) technique, the pH of the solution was readjusted to 2.0-3.0. The acidic solution reduced the dissociation of the carboxylic acid and improved the lipophilic and cationic character of ecgonidine. The compound was extracted from the solution with the SPE technique with an 89-99% yield. Ecgonidine was then detected as a tert-butyldimethylsilyl derivative by a gas chromatographic/electron ionization mass spectrometric method. Quantitation was linear over the concentration range 7-2000 ng ml-1. Concentrations as low as 7 ng ml-1 can be detected by this procedure. Ecgonidine was detected in > 95% of benzoylecgonine-positive urine specimens from a random drug testing program, indicating smoking as the major route of cocaine administration.