ALBANY — New York will raise its smoking age from 18 to 21 under legislation signed into law Tuesday by the state’s governor.

The change, which takes effect in 120 days, will apply to the sales of traditional tobacco products as well as electronic cigarettes and vaporizers.

Gov. Andrew Cuomo, a Democrat, said too many children and teens pick up smoking despite decades of efforts to snuff out the habit, in part because of marketing aimed at young people.

“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,” he said in a statement announcing his signature.

According to the American Cancer Society, 95 percent of all smokers begin using tobacco before age 21. Raising the smoking age to 21 — a proposal the Society dubs “tobacco 21” — had been a major priority for the group in New York.

“Tobacco 21 is a no-brainer,” said Julie Hart, senior government relations director for the American Cancer Society Cancer Action Network of New York.

Sixteen states have approved raising the smoking age to 21, though in some the changes won’t take effect until later in 2019 or in coming years.

In addition, hundreds of local communities around the nation have made the move to 21. In New York state they include New York City, Long Island, Albany and a dozen other counties.