Despite the growing awareness of the harms produced by chronic opioid use, tramadol is still favourably recommended by remarkable clinical guidelines, therefore we aimed to assess the incidence of adverse events among incident users of tramadol compared to codeine users among subjects ≥ 18 years old in Catalonia, Spain. We conducted a population-based cohort study using the SIDIAP database (www.sidiap.org) which is a primary care database that covers over 5 million subjects in Catalonia (Spain). We included all incident users of study drugs (tramadol/codeine) (2007-2017) with no use in the previous year and ≥18 years old, ≥1 year of valid data. We excluded those with combined dispensation of tramadol and codeine in the same day as well as subjects with any of the outcome events of interest at the index date. Follow-up: (latest of) start of the study period or 1-year of valid data until (earliest of) end of enrolment, date of last capturing data, event of interest or end of follow-up. Our exposure were incident tramadol or codeine use (active comparator) and our outcomes, a composite cardiovascular event (cardiac arrythmia, heart failure, myocardial infarction, stroke), delirium, fractures, falls, sleep disorders, constipation, opioid dependence/abuse, all-cause mortality. Confounders: sociodemographic and socioeconomic characteristics, life style factors (alcohol and tobacco status), medical conditions and drugs, ATCs prescribed, GP visits, hospital admissions and traffic accidents. We calculated the Incidence rates, absolute rate difference, and adjusted hazard ratios with 95% confidence intervals using cause-specific Cox proportional hazards regression model accounting for competing risk of death. Propensity-score matching was used to minimize confounding.