This paper describes development, optimization and validation of a method for the simultaneous determination of 29 multi-class pharmaceuticals using off line solid phase extraction (SPE) followed by liquid chromatography–triple quadrupole mass spectrometry (LC–MS–MS). Target compounds include analgesics and non-steroidal anti-inflammatories (NSAIDs), lipid regulators, psychiatric drugs, anti-histaminics, anti-ulcer agent, antibiotics and β-blockers. Recoveries obtained were generally higher than 60% for both surface and wastewaters, with exception of several compounds that yielded lower, but still acceptable recoveries: ranitidine (50%), sotalol (50%), famotidine (50%) and mevastatin (34%). The overall variability of the method was below 15%, for all compounds and all tested matrices. Method detection limits (MDL) varied between 1 and 30 ng/L and from 3 to 160 ng/L for surface and wastewaters, respectively. The precision of the method, calculated as relative standard deviation (R.S.D.), ranged from 0.2 to 6% and from 1 to 11% for inter and intra-day analysis, respectively. A detailed study of matrix effects was performed in order to evaluate the suitability of different calibration approaches (matrix-matched external calibration, internal calibration, extract dilution) to reduce analyte suppression or enhancement during instrumental analysis. The main advantages and drawbacks of each approach are demonstrated, justifying the selection of internal standard calibration as the most suitable approach for our study. The developed analytical method was successfully applied to the analysis of pharmaceutical residues in WWTP influents and effluents, as well as in river water. For both, river and wastewaters, the most ubiquitous compounds belonged to the group of anti-inflammatories and analgesics, antibiotics, the lipid regulators being acetaminophen, trimethoprim, ibuprofen, ketoprofen, atenolol, propranolol, mevastatin, carbamazepine and ranitidine the most frequently detected compounds.