Glioblastoma is the most common primary central nervous system malignancy and has a poor prognosis. Standard first-line treatment, which includes surgery followed by adjuvant radio-chemotherapy, produces only modest benefits to survival1,2. Here, to explore the feasibility, safety and immunobiological effects of PD-1 blockade in patients undergoing surgery for glioblastoma, we conducted a single-arm phase II clinical trial (NCT02550249) in which we tested a presurgical dose of nivolumab followed by postsurgical nivolumab until disease progression or unacceptable toxicity in 30 patients (27 salvage surgeries for recurrent cases and 3 cases of primary surgery for newly diagnosed patients). Availability of tumor tissue pre- and post-nivolumab dosing and from additional patients who did not receive nivolumab allowed the evaluation of changes in the tumor immune microenvironment using multiple molecular and cellular analyses. Neoadjuvant nivolumab resulted in enhanced expression of chemokine transcripts, higher immune cell infiltration and augmented TCR clonal diversity among tumor-infiltrating T lymphocytes, supporting a local immunomodulatory effect of treatment. Although no obvious clinical benefit was substantiated following salvage surgery, two of the three patients treated with nivolumab before and after primary surgery remain alive 33 and 28 months later.