Multiple sclerosis (MS) is a chronic inflammatory demyelinating disease of the central nervous system of unknown etiology. We tested the hypothesis that MS is caused by Epstein-Barr virus (EBV) in a cohort comprising more than 10 million young adults on active duty in the US military, 955 of whom were diagnosed with MS during their period of service. Risk of MS increased 32-fold after infection with EBV but was not increased after infection with other viruses, including the similarly transmitted cytomegalovirus. Serum levels of neurofilament light chain, a biomarker of neuroaxonal degeneration, increased only after EBV seroconversion. These findings cannot be explained by any known risk factor for MS and suggest EBV as the leading cause of MS.