A simple on-line method was developed for the analysis of pharmaceuticals, pesticides and some metabolites in drinking, surface and wastewater samples. The technique is based on the use of on-line solid-phase extraction combined with liquid chromatography electrospray tandem mass spectrometry with positive electrospray ionization (LC-ESI(PI)-MS/MS). The injection of only 1 mL of filtered water sample is used with a total analysis time of 20 min, including the period required to flush the SPE cartridge with organic solvent and reconditioning the LC column. Method detection limits were in the range of 2 to 24 ng L(-1) for the compounds of interest, with recoveries from 87 to 110% in surface as well as wastewater samples. Matrix effects were observed for some compounds without exceeding more than 25%. All results displayed a good degree of reproducibility, with relative standard deviations (RSD) of less than 12% for all compounds. Moreover, at least 200 samples were analyzed without altering the performance of the pre-concentration column. This method was preferred over traditional off-line procedures because it minimizes tedious sample preparation, increases productivity and sample throughput. The analysis of various water and wastewater samples showed that caffeine, carbamazepine and atrazine could be detected in all the samples analysed and the selected compounds are always present in at least one of the sample types.