The analysis of illicit drugs in urban wastewater is the basis of wastewater‐based epidemiology (WBE), and has received much scientific attention because the concentrations measured can be used as a new non‐intrusive tool to provide evidence‐based and real‐time estimates of community‐wide drug consumption. Moreover, WBE allows monitoring patterns and spatial and temporal trends of drug use. Although information and expertise from other disciplines is required to refine and effectively apply WBE, analytical chemistry is the fundamental driver in this field. The use of advanced analytical techniques, commonly based on combined chromatography—mass spectrometry, is mandatory because the very low analyte concentration and the complexity of samples (raw wastewater) make quantification and identification/confirmation of illicit drug biomarkers (IDBs) troublesome. We review the most‐recent literature available (mostly from the last 5 years) on the determination of IDBs in wastewater with particular emphasis on the different analytical strategies applied. The predominance of liquid chromatography coupled to tandem mass spectrometry to quantify target IDBs and the essence to produce reliable and comparable results is illustrated. Accordingly, the importance to perform inter‐laboratory exercises and the need to analyze appropriate quality controls in each sample sequence is highlighted. Other crucial steps in WBE, such as sample collection and sample pre‐treatment, are briefly and carefully discussed. The article further focuses on the potential of high‐resolution mass spectrometry. Different approaches for target and non‐target analysis are discussed, and the interest to perform experiments under laboratory‐controlled conditions, as a complementary tool to investigate related compounds (e.g., minor metabolites and/or transformation products in wastewater) is treated. The article ends up with the trends and future perspectives in this field from the authors’ point of view. © 2016 by The Authors. Mass Spectrometry Reviews published by Wiley Periodicals, Inc. Mass Spec Rev 37:258–280, 2018