Background: Despite the improvement in the prognosis of acute coronary syndrome (ACS), substantial morbidity and mortality remain. We aimed to evaluate the effect of obstructive sleep apnoea (OSA) and its treatment with continuous positive airway pressure (CPAP) on the clinical evolution of patients with ACS. Methods: We designed a multicentre, open-label, parallel-group, randomised controlled trial of patients with ACS at 15 hospitals in Spain. Eligible non-sleepy patients were men and women aged 18 years and older, admitted to hospital for documented symptoms of ACS. All patients underwent respiratory polygraphy during the first 24–72 h after admission. OSA patients were randomly assigned (1:1) to CPAP treatment plus usual care (CPAP group) or usual care alone (UC group) by a computerised system available 24 h a day. A group of patients with ACS but without OSA was also included as a reference group. Because of the nature of the intervention, the trial intervention could not be masked to either investigators or patients. Patients were monitored and followed for a minimum of 1 year. Patients were examined at the time of inclusion; after 1 month, 3 months, 6 months, 12 months, 18 months, 24 months, 30 months, and 36 months; and every 12 months thereafter, if applicable, during the follow-up period. The primary endpoint was the prevalence of a composite of cardiovascular events (cardiovascular death or non-fatal events [Acute myocardial infarction, non-fatal stroke, hospital admission for heart failure, and new hospitalisations for unstable angina or transient ischaemic attack]) in patients followed up for a minimum of 1 year. The primary analysis was done according to the intention-to-treat principle. This study is registered with Clinicaltrials.gov, NCT01335087 and is now closed. Findings: Between April 25, 2011, and Feb 2, 2018, a total of 2834 patients with ACS had respiratory polygraphy, of whom 2551 (90·01%) were recruited. 1264 (49·55%) patients had OSA and were randomly assigned to the CPAP group (n=633) or the UC group (n=631). 1287 (50·45%) patients did not have OSA, of whom 603 (46·85%) were randomly assigned to the reference group. Patients were followed up for a median of 3·35 years (IQR 1·50–5·31). The prevalence of cardiovascular events was similar in the CPAP and UC groups (98 events [16%] vs 108 events [17%]; hazard ratio [HR] 0·89 [95% CI 0·68–1·17]; p=0·40) during follow-up. Mean time of adherence to CPAP treatment was 2·78 h/night (SD 2·73). The prevalence of cardiovascular events was similar between patients in the reference group (90 [15%] events) and those in the UC group (102 (17%) events) during follow-up (1·01 [0·76–1·35]; p=0·93). The prevalence of cardiovascular events seem not to be related to CPAP compliance or OSA severity. 464 (74%) of 629 patients in the CPAP group had 1538 serious adverse events and 406 (65%) of 626 patients in the UC group had 1764 serious adverse events. Interpretation: Among non-sleepy patients with ACS, the presence of OSA was not associated with an increased prevalence of cardiovascular events and treatment with CPAP did not significantly reduce this prevalence.