(CNN) — A new law sets the minimum age to buy tobacco products at 21 years old.

President Donald Trump signed the measure into law Friday.

It’s part of the $1.4 trillion spending agreement to fund the federal government.

A bipartisan group of senators have wanted the measure for some time.

They finally got it pushed through by attaching it to a bill that had to pass to avoid a government shutdown.

The measure applies to traditional tobacco products like cigarettes and vaping devices.

President Trump supports the change.

Several states had already raised their ages for purchasing tobacco — but the measure now mandates it nationwide.