New York, beset by the worst measles outbreak in decades, eliminated religious exemptions from school-vaccination rules, becoming the fifth state to do so.

Members of the Democratic-controlled Senate and Assembly approved the bill, which mandates that children be immunized to attend school, after hours of floor debates and raucous demonstrations inside the state Capitol by roughly 100 antivaccination protesters. Gov. Andrew Cuomo, a Democrat, signed it Thursday afternoon.

The...