A new, simple, sensitive, and low‐cost voltammetric method using an as‐grown boron‐doped diamond electrode was developed for the determination of erythromycin in environmental (water) samples. Erythromycin provided an irreversible oxidation peak at a potential of + 0.87 V versus Ag/AgCl/KCl (3 mol/L) electrode in an ammonium acetate buffer (pH 5). Under optimal experimental conditions, square‐wave voltammetry was used for the determination of erythromycin. The calibration curves showed good linearity in a concentration range from 6.8 to 68.1 μmol/L with the coefficient of determination R2 = 0.9993. The limit of detection of the proposed method was 1.1 μmol/L. Very good repeatability (n = 7) at three different concentration levels (6.8, 13.6 and 20.4 μmol/L) was obtained (RSD of 2.4, 1.8, 1.6, respectively). The developed square‐wave method was successfully applied to the determination of erythromycin in several different water samples with good recovery (from 89 to 107%).