Objectives To examine the association between postpartum urinary tract infection and intended mode of delivery as well as actual mode of delivery. Design Retrospective cohort study. Setting and participants All live births in Denmark between 2004 and 2010 (n=450 856). Births were classified by intended caesarean delivery (n=45 053) or intended vaginal delivery (n=405 803), and by actual mode of delivery: spontaneous vaginal delivery, operative vaginal delivery, emergency or planned caesarean delivery in labour or prelabour. Primary and secondary outcome measures The primary outcome measure was postpartum urinary tract infection (n=16 295) within 30 days post partum, defined as either a diagnosis of urinary tract infection in the National Patient Registry or redemption of urinary tract infection-specific antibiotics recorded in the Register of Medicinal Product Statistics. Results We found that 4.6% of women with intended caesarean delivery and 3.5% of women with intended vaginal delivery were treated for postpartum urinary tract infection. Women with intended caesarean delivery had a significantly increased risk of postpartum urinary tract infection compared with women with intended vaginal delivery (OR 1.33, 95% CI 1.27 to 1.40), after adjustment for age at delivery, smoking, body mass index, educational level, gestational diabetes mellitus, infection during pregnancy, birth weight, preterm delivery, preterm prelabour rupture of membranes, pre-eclampsia, parity and previous caesarean delivery (adjusted OR 1.24, 95% CI 1.17 to 1.46). Using actual mode of delivery as exposure, all types of operative delivery had an equally increased risk of postpartum urinary tract infection compared with spontaneous vaginal delivery. Conclusions Compared with intended vaginal delivery, intended caesarean delivery was significantly associated with a higher risk of postpartum urinary tract infection. Future studies should focus on reducing routine catheterisation prior to operative vaginal delivery as well as improving procedures related to catheterisation.