Background The benefit of CT coronary angiography (CTCA) in patients presenting with stable chest pain has not been systematically studied. We aimed to assess the effect of CTCA on the diagnosis, management, and outcome of patients referred to the cardiology clinic with suspected angina due to coronary heart disease. Methods In this prospective open-label, parallel-group, multicentre trial, we recruited patients aged 18-75 years referred for the assessment of suspected angina due to coronary heart disease from 12 cardiology chest pain clinics across Scotland. We randomly assigned (1:1) participants to standard care plus CTCA or standard care alone. Randomisation was done with a web-based service to ensure allocation concealment. The primary endpoint was certainty of the diagnosis of angina secondary to coronary heart disease at 6 weeks. All analyses were intention to treat, and patients were analysed in the group they were allocated to, irrespective of compliance with scanning. This study is registered with ClinicalTrials.gov, number NCT01149590. Findings Between Nov 18, 2010, and Sept 24, 2014, we randomly assigned 4146 (42%) of 9849 patients who had been referred for assessment of suspected angina due to coronary heart disease. 47% of participants had a baseline clinic diagnosis of coronary heart disease and 36% had angina due to coronary heart disease. At 6 weeks, CTCA reclassified the diagnosis of coronary heart disease in 558 (27%) patients and the diagnosis of angina due to coronary heart disease in 481 (23%) patients (standard care 22 [1%] and 23 [1%]; p<0·0001). Although both the certainty (relative risk [RR] 2·56, 95% CI 2·33-2·79; p<0·0001) and frequency of coronary heart disease increased (1·09, 1·02-1·17; p=0·0172), the certainty increased (1·79, 1·62-1·96; p<0·0001) and frequency seemed to decrease (0·93, 0·85-1·02; p=0·1289) for the diagnosis of angina due to coronary heart disease. This changed planned investigations (15% vs 1%; p<0·0001) and treatments (23% vs 5%; p<0·0001) but did not affect 6-week symptom severity or subsequent admittances to hospital for chest pain. After 1·7 years, CTCA was associated with a 38% reduction in fatal and non-fatal myocardial infarction (26 vs 42, HR 0·62, 95% CI 0·38-1·01; p=0·0527), but this was not significant. Interpretation In patients with suspected angina due to coronary heart disease, CTCA clarifies the diagnosis, enables targeting of interventions, and might reduce the future risk of myocardial infarction. Funding The Chief Scientist Office of the Scottish Government Health and Social Care Directorates funded the trial with supplementary awards from Edinburgh and Lothian's Health Foundation Trust and the Heart Diseases Research Fund.