The state’s tobacco and e-cigarette will soon be raised from 18 to 21 as Gov. Andrew Cuomo signed the measure on Tuesday into law.

The measure will take effect in four months. It matches what counties around the state have done: Raising the minimum age for buying tobacco, cigarettes, e-cigarettes and other tobacco-related products to match the minimum age for buying alcohol.

College campuses have in recent years stopped selling cigarettes and banned smoking.

“New York is taking aggressive action to stamp out smoking among teens and children, but tobacco and e-cigarette use still persists thanks to irresponsible corporate marketing campaigns targeting young people,” Cuomo said.

“By raising the smoking age from 18 to 21, we can stop cigarettes and e-cigarettes from getting into the hands of young people in the first place and prevent an entire generation of New Yorkers from forming costly and potentially deadly addictions.”

The bill’s approval was cheered by health advocates.

“By making 21 the legal sales age to purchase tobacco products, it will drive down youth use rates by eliminating kids’ source of tobacco — their older friends,” said Theresa Petrone Butts, chair of the Capital Region Advisory Board of the American Heart Association.