Background: Cemiplimab has shown substantial antitumour activity in patients with metastatic cutaneous squamous cell carcinoma. Patients with locally advanced cutaneous squamous cell carcinoma have poor prognosis with conventional systemic therapy. We present a primary analysis of the safety and antitumour activity of cemiplimab in patients with locally advanced cutaneous squamous cell carcinoma. Methods: This pivotal open-label, phase 2, single-arm trial was done across 25 outpatient clinics, primarily at academic medical centres, in Australia, Germany, and the USA. Eligible patients (aged ≥18 years with histologically confirmed locally advanced cutaneous squamous cell carcinoma and an Eastern Cooperative Oncology Group performance status of 0–1) received cemiplimab 3 mg/kg intravenously over 30 min every 2 weeks for up to 96 weeks. Tumour measurements were done every 8 weeks. The primary endpoint was objective response, defined as the proportion of patients with complete or partial response, according to independent central review as per Response Evaluation Criteria in Solid Tumors version 1.1 for radiological scans and WHO criteria for medical photography. Data cutoff was Oct 10, 2018, when the fully enrolled cohort reached the prespecified timepoint for the primary analysis. Analyses were done as per the intention-to-treat principle. The safety analysis comprised all patients who received at least one dose of cemiplimab. This study is registered with ClinicalTrials.gov, number NCT02760498. Findings: Between June 14, 2016, and April 25, 2018, 78 patients were enrolled and treated with cemiplimab. The median duration of study follow-up was 9·3 months (IQR 5·1–15·7) at the time of data cutoff. An objective response was observed in 34 (44%; 95% CI 32–55) of 78 patients. The best overall response was ten (13%) patients with a complete response and 24 (31%) with a partial response. Grade 3–4 treatment-emergent adverse events occurred in 34 (44%) of 78 patients; the most common were hypertension in six (8%) patients and pneumonia in four (5%). Serious treatment-emergent adverse events occurred in 23 (29%) of 78 patients. One treatment-related death was reported that occurred after onset of aspiration pneumonia. Interpretation: Cemiplimab showed antitumour activity and an acceptable safety profile in patients with locally advanced cutaneous squamous cell carcinoma for whom there was no widely accepted standard of care. Funding: Regeneron Pharmaceuticals and Sanofi.