BACKGROUND: Late-stage isolated medial knee osteoarthritis can be treated with total knee replacement (TKR) or partial knee replacement (PKR). There is high variation in treatment choice and little robust evidence to guide selection. The Total or Partial Knee Arthroplasty Trial (TOPKAT) therefore aims to assess the clinical effectiveness and cost-effectiveness of TKR versus PKR in patients with medial compartment osteoarthritis of the knee, and this represents an analysis of the main endpoints at 5 years. METHODS: Our multicentre, pragmatic randomised controlled trial was done at 27 UK sites. We used a combined expertise-based and equipoise-based approach, in which patients with isolated osteoarthritis of the medial compartment of the knee and who satisfied general requirements for a medial PKR were randomly assigned (1:1) to receive PKR or TKR by surgeons who were either expert in and willing to perform both surgeries or by a surgeon with particular expertise in the allocated procedure. The primary endpoint was the Oxford Knee Score (OKS) 5 years after randomisation in all patients assigned to groups. Health-care costs (in UK 2017 prices) and cost-effectiveness were also assessed. This trial is registered with ISRCTN (ISRCTN03013488) and ClinicalTrials.gov (NCT01352247). FINDINGS: Between Jan 18, 2010, and Sept 30, 2013, we assessed 962 patients for their eligibility, of whom 431 (45%) patients were excluded (121 [13%] patients did not meet the inclusion criteria and 310 [32%] patients declined to participate) and 528 (55%) patients were randomly assigned to groups. 94% of participants responded to the follow-up survey 5 years after their operation. At the 5-year follow-up, we found no difference in OKS between groups (mean difference 1·04, 95% CI -0·42 to 2·50; p=0·159). In our within-trial cost-effectiveness analysis, we found that PKR was more effective (0·240 additional quality-adjusted life-years, 95% CI 0·046 to 0·434) and less expensive (-£910, 95% CI -1503 to -317) than TKR during the 5 years of follow-up. This finding was a result of slightly better outcomes, lower costs of surgery, and lower follow-up health-care costs with PKR than TKR. INTERPRETATION: Both TKR and PKR are effective, offer similar clinical outcomes, and result in a similar incidence of re-operations and complications. Based on our clinical findings, and results regarding the lower costs and better cost-effectiveness with PKR during the 5-year study period, we suggest that PKR should be considered the first choice for patients with late-stage isolated medial compartment osteoarthritis. FUNDING: National Institute for Health Research Health Technology Assessment Programme.