ObjectivesTramadol is a widely prescribed analgesic that influences both opioid and monoamine neurotransmission. While seizures have been reported with its use, the risk in clinical practice has not been well characterised. We examined risk of seizure with tramadol relative to codeine, a comparable opioid analgesic.DesignRetrospective nested case-control study. For each case, we identified up to 10 controls matched on age, sex, US state of residence and date of cohort entry (±365 days). We calculated ORs to determine the association between seizure and exposure to tramadol, codeine (≥15 mg), both or neither, in the preceding 30 days.SettingCohort of patients, who had continuous health coverage and resided in the same state for≥3 years, identified from linked administrative health data in US MarketScan databases from 2009 to 2012.ParticipantsWe identified 96 753 patients with seizure and 888 540 matched controls.Primary and secondary outcome measuresIn the primary analysis, we defined cases using a broad definition of seizure (based on either an outpatient physician claim for seizure disorder or a seizure-related emergency department visit or hospitalisation). In a secondary analysis, we used a more specific definition of seizure restricted to a hospital visit with a principal diagnosis of seizure.ResultsIn the primary analysis, we found no association between risk of seizure and exposure to tramadol compared with codeine (OR 1.03, 95% CI 0.93 to 1.15). However, in the secondary analysis (using a more specific definition of seizure), this association was statistically significant (OR 1.41, 95% CI 1.11 to 1.79).ConclusionsTramadol was not associated with an increased risk of seizure defined by inpatient and outpatient diagnoses. However, this finding was sensitive to the outcome definition used and requires further study.