<p><strong>Abstract.</strong> Tropospheric O<sub>3</sub> remains a major air-quality issue in the Mediterranean region. The combination of large anthropogenic emissions of precursors, transboundary contributions, a warm and dry aestival climate and topographical features results in severe cases of photochemical pollution. Chemical transport models (CTMs) are essential tools for studying O<sub>3</sub> dynamics and for assessing mitigation measures but they need to be evaluated specifically for each air basin. In this study, we present an optimisation of the LOTOS-EUROS CTM for the Madrid air basin. Five configurations using different meteorological datasets (from the European Centre for Medium Weather Forecast (ECMWF) and Weather Research and Forecasting (WRF)), horizontal resolution and number of vertical levels were compared for July 2016. LOTOS-EUROS responded satisfactorily in the five configurations reproducing observations of surface O<sub>3</sub> with notable correlation and reduced bias and errors. However, the best-fit simulations for surface O<sub>3</sub> were obtained by increasing spatial resolution and using a large number of vertical levels to reproduce vertical transport phenomena and the formation of reservoir layers. Using the optimal configuration obtained in the evaluation, three characteristic events have been described: recirculation (REC) episodes and northern and southern advection (NAD and SAD, respectively) events. REC events were found to produce the highest O<sub>3</sub> due to the reduced ventilation associated with low wind speeds and the contribution of reservoir layers formed by vertical transport of O<sub>3</sub> formed near the surface in the previous days of the event. NAD events, usually associated with higher wind speeds, present the lowest ground-level O<sub>3</sub> concentrations in the region. During SAD episodes, external contributions along with low wind speeds allow O<sub>3</sub> to increase considerably, but not as much as in REC events because steady southerly winds disperse local emissions and hinder the formation of reservoir layers.</p>