Background: Spesolimab is an anti-interleukin-36 receptor monoclonal antibody approved to treat generalised pustular psoriasis (GPP) flares. We aimed to assess the efficacy and safety of spesolimab for GPP flare prevention. Methods: This multicentre, randomised, placebo-controlled, phase 2b trial was done at 60 hospitals and clinics in 20 countries. Eligible study participants were aged between 12 and 75 years with a documented history of GPP as per the European Rare and Severe Psoriasis Expert Network criteria, with a history of at least two past GPP flares, and a GPP Physician Global Assessment (GPPGA) score of 0 or 1 at screening and random assignment. Patients were randomly assigned (1:1:1:1) to receive subcutaneous placebo, subcutaneous low-dose spesolimab (300 mg loading dose followed by 150 mg every 12 weeks), subcutaneous medium-dose spesolimab (600 mg loading dose followed by 300 mg every 12 weeks), or subcutaneous high-dose spesolimab (600 mg loading dose followed by 300 mg every 4 weeks) over 48 weeks. The primary objective was to demonstrate a non-flat dose-response curve on the primary endpoint, time to first GPP flare. Findings: From June 8, 2020, to Nov 23, 2022, 157 patients were screened, of whom 123 were randomly assigned. 92 were assigned to receive spesolimab (30 high dose, 31 medium dose, and 31 low dose) and 31 to placebo. All patients were either Asian (79 [64%] of 123) or White (44 [36%]). Patient groups were similar in sex distribution (76 [62%] female and 47 [38%] male), age (mean 40·4 years, SD 15·8), and GPP Physician Global Assessment score. A non-flat dose-response relationship was established on the primary endpoint. By week 48, 35 patients had GPP flares; seven (23%) of 31 patients in the low-dose spesolimab group, nine (29%) of 31 patients in the medium-dose spesolimab group, three (10%) of 30 patients in the high-dose spesolimab group, and 16 (52%) of 31 patients in the placebo group. High-dose spesolimab was significantly superior versus placebo on the primary outcome of time to GPP flare (hazard ratio [HR]=0·16, 95% CI 0·05-0·54; p=0·0005) endpoint. HRs were 0·35 (95% CI 0·14-0·86, nominal p=0·0057) in the low-dose spesolimab group and 0·47 (0·21-1·06, p=0·027) in the medium-dose spesolimab group. We established a non-flat dose-response relationship for spesolimab compared with placebo, with statistically significant p values for each predefined model (linear p=0·0022, emax1 p=0·0024, emax2 p=0·0023, and exponential p=0·0034). Infection rates were similar across treatment arms; there were no deaths and no hypersensitivity reactions leading to discontinuation. Interpretation: High-dose spesolimab was superior to placebo in GPP flare prevention, significantly reducing the risk of a GPP flare and flare occurrence over 48 weeks. Given the chronic nature of GPP, a treatment for flare prevention is a significant shift in the clinical approach, and could ultimately lead to improvements in patient morbidity and quality of life.