Sulfamethoxazole is an antibiotic that is among the drugs most frequently found in waters around the world because of its habitual consumption and its high chemical stability that prevents it from being eliminated from the environment. In this study, an electroanalytical methodology based on differential pulse voltammetry is developed for the analysis of sulfamethoxazole at trace levels in water. After the optimization of the instrumental parameters a linear range from 6.59 to 96.27 μM was found with limits of detection and quantification of 1.98 and 6.59 μM, respectively, with an RSD below 6 %. Moreover, several validation studies involving different pH values, water samples and instrumentation-techniques were performed in order to ensure the robustness of the method. For this purpose, the peak area was used as quantitative variable since it is not affected by the pH of the medium even if there is any modification of this parameter during the experiments. Furthermore, the effect of other drug such as trimethoprim on the analytical signal of sulfamethoxazole was also evaluated. Once the method was developed it was tested on the quality control of Soltrim®, obtaining recoveries between 98 and 102 %. Lastly, the voltammetric method was applied for the in situ monitoring of sulfamethoxazole's removal from water samples, specifically by anodic oxidation and electro-Fenton treatments. While the former was coupled to an adsorption process, the latter was carried out with different iron sources including commercial medicines that can be found in wastewater. The problem of significant variation in pH during the treatment was solved by working with the peak area, and so obtaining valid and reliable kinetic data. Although anodic oxidation proved to be faster considering the calculated kobs, electro-Fenton turned out to be more efficient in eliminating the drug, achieving the disappearance of its analytical signal in only 30 min of treatment.