Objective To assess the effect of comedication with conventional synthetic disease modifying antirheumatic drugs (csDMARDs) on retention to tumour necrosis factor inhibitor (TNFi) therapy in patients with ankylosing spondylitis (AS) and undifferentiated spondyloarthritis (uSpA). Methods Data on patients with a clinical diagnosis of AS or uSpA starting treatment with adalimumab, etanercept or infliximab as their first TNFi during 2003-2010 were retrieved from the Swedish national biologics register and linked to national population based registers. Five-year drug survival was analysed by Cox regression with age, sex, baseline csDMARD comedication, TNFi type, prescription year and covariates representing frailty and socioeconomic status. AS and uSpA were analysed separately. Sensitivity analyses included models with csDMARD as a time-dependent covariate and adjustments for additional potential confounders. Results 1365 patients with AS and 1155 patients with uSpA were included, of whom 40.8% versus 50.3% used csDMARD comedication at baseline. In the unadjusted analyses superior drug survival was observed for patients using versus not using csDMARD comedication among patients with AS (p<0.001) but not among patients with uSpA (p=0.175). In the multivariable Cox regression analyses comedication with csDMARD was associated with better retention to TNFi therapy both in AS (HR 0.71, p<0.001) and uSpA (HR 0.82, p=0.020). The results were similar with csDMARD comedication as a time-dependent covariate, and the associations were retained when adjusting for erythrocyte sedimentation rate, C-reactive protein, patient global, swollen joints, uveitis, psoriasis and inflammatory bowel disease. Conclusions In this large register study of patients with AS and uSpA, use of csDMARD comedication was associated with better 5-year retention to the first TNFi.