In a retrospective cohort study of 43,527 patients with autoimmune and inflammatory diseases (ankylosing spondylitis, inflammatory bowel disease, psoriasis, psoriatic arthritis and rheumatoid arthritis) with herpes zoster infection (HZ), HZ was identified as a risk factor for stroke occurring soon afterwards. The adjusted incidence rate ratio (IRR) for stroke within 90 days of HZ was 1.36 (95% CI 1.10–1.68) in the overall cohort, and 1.77 (0.97–3.23) in those with HZ-related cranial nerve complications. Prompt antiviral treatment reduced the IRR for subsequent stroke to 0.83 (95% CI 0.70–0.98).