The comparison of two methods based on online solid phase extraction-liquid chromatography with UV (SPE-LC-UV) or mass spectrometry detection (SPE-LC-MS/MS) for the simultaneous quantification of sulfamethoxazole (SMZ) and trimethoprim (TMP) is presented. The methods were validated and proved to be accurate. The analysis of standard samples for SMZ at concentrations of 0.5, 1.5, 25 and 50microg/mL demonstrated a relative standard deviation of less than 6% for both methods (n=18), while TMP samples at concentrations of 0.05, 0.15, 1.5 and 5.0microg/mL were analyzed with R.S.D. of less than 4% (n=18). The method with mass spectrometric detection was approximately six times more sensitive than the method with ultraviolet detection. The total run time for the SPE-LC-MS/MS was 2.5min per sample as opposed to 18.0min for the SPE-LC-UV method. The method with MS detection in comparison with UV detection proved to be more rugged and was successfully applied to pharmacokinetics studies.