Background and purpose — Early postoperative mortality is relatively high after total hip arthroplasty (THA) that has been performed due to femoral neck fracture. However, this has rarely been investigated after adjustment for medical comorbidity and comparison with the mortality in an age-matched population. We therefore assessed early mortality in hip fracture patients treated with a THA, in the setting of a nationwide matched cohort study.Patients and methods — 24,699 patients who underwent THA due to a femoral neck fracture between 1992 and 2012 were matched with 118,518 controls. Kaplan-Meier survival analysis was used to calculate cumulative unadjusted survival, and Cox regression models were fitted to compute hazard ratios (HRs) and 95% confidence intervals (CIs), with adjustment for age, sex, comorbidity, and socioeconomic background.Results — 90-day survival was 96.3% (95% CI: 96.0–96.5) for THA cases and 98.7% (95% CI: 98.6–98.8) for control individuals, giving an adjusted HR of 2.2 (95% CI: 2.0–2.4) for THA cases compared to control individuals. Comorbidity burden increased in THA cases over time, but the adjusted risk of death within 90 days did not differ statistically significantly between the time periods investigated (1992–1998, 1999–2005, and 2006–2012). A Charlson comorbidity index of 3 or more, an American Society of Anesthesiologists (ASA) grade of 3 and above, male sex, an age of 80 years and above, an income below the first quartile, and a lower level of education were all associated with an increased risk of 90-day mortality.Interpretation — The adjusted early mortality in femoral neck fracture patients who underwent THA was about double that in a matched control population. Patients with femoral neck fracture but with no substantial comorbidity and an age of less than 80 years appear to have a low risk of early death. Patients older than 80 years and those with a Charlson comorbidity index of more than 2 have a high risk of early death, and such patients would perhaps benefit from treatment strategies other than THA, but this should be investigated further.