The chicke npox vaccine not only protects against chickenpox: A new study has found it also lowers the risk for shingles.

Shingles, sometimes called herpes zoster, is a painful nerve infection and rash that can occur after recovery from a case of chickenpox or after immunization with the vaccine. It is more common in older people and can occur decades after recovery from chickenpox, but children can get it, too.

The study, in Pediatrics, included 6.4 million children under 18, half of whom had the chickenpox vaccine. The researchers calculated rates of shingles from 2003 through 2014.

They found that over all, the vaccinated children had a 78 percent lower rate of shingles than their unvaccinated peers. The Centers for Disease Control and Prevention recommends two doses of the vaccine, at age 1 year and then between 4 and 6. Among children who had both doses, rates of shingles were even lower.