SACRAMENTO, Calif. — California lawmakers voted Thursday to raise the legal age for purchasing and using tobacco and e-cigarettes from 18 to 21, putting the nation's most populous state on the brink of becoming only the second after Hawaii to bar teenagers from lighting up, dipping or vaping.

Before it can become law, Democratic Gov. Jerry Brown must sign the legislation, which has already passed the state Assembly. His spokesman said the governor generally does not comment on pending legislation.

Only Hawaii has adopted the higher age limit statewide, although dozens of cities, including New York and San Francisco, have passed similar laws of their own.

"We can prevent countless California youth from becoming addicted to this deadly drug, save billions of dollars in direct health care costs and, most importantly, save lives," said Democratic Sen. Ed Hernandez, who wrote the bill.

The higher age limit, part of a package of anti-tobacco bills, won approval despite intense lobbying from tobacco interests and fierce opposition from many Republicans, who said the state should butt out of people's personal health decisions, even if they are harmful.

The six bills that passed both houses represented California's most substantial anti-tobacco effort in nearly two decades, according to the American Cancer Society.

"With California having such a huge population, it's going to be very impactful nationwide," said Cathy Callaway, associate director of state and local campaigns for the society.

Advocates noted that the vast majority of smokers start before they are 18, according to data from the U.S. surgeon general. Making it illegal for 18-year-old high school students to buy tobacco for their underage friends will make it more difficult for teens to get the products, they said.

Opponents said American law and custom has long accepted that people can make adult decisions on their 18th birthday and live with the consequences. Eighteen-year-olds can register to vote, join the military, sign legally binding contracts, consent to sex and do just about any legal activity besides buying alcohol.

In response, Democrats changed the bill to allow members of the military to continue buying cigarettes at 18.

"You can commit a felony when you're 18 years old and for the rest of your life, be in prison," Assembly Republican Leader Chad Mayes said. "And yet you can't buy a pack of cigarettes."

Another bill would classify e-cigarettes, or "vaping" devices, as tobacco products subject to the same restrictions on who can purchase them and where they can be used.

The Food and Drug Administration has proposed regulations for e-cigarettes, but none has taken effect.

Anti-tobacco groups fear that vaporizers are enticing to young people and may encourage them to eventually take up smoking.

"All the progress we've made since 1965 to educate people about the hazards of smoking may be for naught as vaping has started a new generation of nicotine junkies that will be helplessly addicted and will ultimately graduate to smoking cancer sticks," said Sen. Jeff Stone, a Republican.

Others say the devices are a less harmful, tar-free alternative to cigarettes. They have not been extensively studied, and there is no scientific consensus on their risks.

A vaping industry group, the Smoke-Free Alternatives Trade Association, urged Brown to veto the bill, saying in a letter that it could pose problems for vape shops.

"The stigma of being equated with tobacco has many negative consequences," the group wrote.

The bills would also expand smoke-free areas to include bars, workplace break rooms, small businesses, warehouses and hotel lobbies and meeting rooms. Smoking bans would apply at more schools, including charter schools, and counties would be able to raise their own cigarette taxes beyond the state's levy of $0.87 per pack.

The legislation would take effect 90 days after the governor signs it.

The Senate vote came just over a week after San Francisco officials opted to raise the tobacco buying age to 21, making it the largest city to do so after New York. Nationwide, more than 120 municipalities have raised the smoking age, according to Tobacco 21, a group that advocates the policy shift nationally.

Hawaii was first to adopt the higher age limit statewide. New Jersey's Legislature voted to raise the smoking age from 19 to 21, but the bill died when Republican Gov. Chris Christie decided not to act on it before a January deadline.

Anti-smoking groups are collecting signatures for a November ballot initiative that would raise the cigarette tax to $2 a pack and direct the money to health care, tobacco-use prevention, research and law enforcement.

There is a reason why the air in Tampa Bay is filled with playoff talk. If Thursday night's 12-8 Bucs preseason win over the Jaguars is any indication, it's also going to be filled with footballs thrown by quarterback Jameis Winston.