In this study, in-line solid-phase extraction (SPE) was used as an enrichment technique in combination with CE for the preconcentration and separation of 2-ethylidene-1,5-dimethyl-3,3-diphenylpyrrolidine (EDDP), cocaine (COC), codeine (COD) and 6-acetylmorphine (6AM). The separation buffer (BGE) used was 80 mM disodium phosphate anhydrous and 6 mM of HCl (final BGE pH of 3). The SPE extractor consists of a small segment of capillary filled with Oasis HLB sorbent and inserted into the inlet section of the electrophoretic capillary. Different parameters affecting preconcentration were evaluated, such as sample pH, the volume of the elution plug and sample injection time. The detection limits (LODs) reached for standard samples by in-line SPE-CE-UV ranged between 50 and 200 ng/L, with sensitivity enhancement factors ranging from 2300 to 5300. Reproducibility values (expressed in terms of relative standard deviation) were below 7.6% for standard samples. This is a simple and an effective method for the determination of the studied drugs of abuse and their metabolites. The applicability of the developed method was demonstrated in tap and river water samples which were directly analyzed without any off-line pretreatment. Analytical parameters were evaluated and LODs were between 70 and 270 ng/L with relative recoveries between 85 and 97%.