SACRAMENTO >> California lawmakers voted Thursday to raise the smoking age from 18 to 21, approving a measure that would make the nation’s most populous state only the second to put legal tobacco products out of the reach of most teenagers.

Before it can become law, Democratic Gov. Jerry Brown must sign the legislation, which has already passed the state Assembly. His spokesman said last week that 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 their own laws.

The package of anti-tobacco bills would also restrict electronic cigarettes, which are increasingly popular and not regulated by the federal government.

The higher age limit 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, which 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 18-year-olds are trusted to make important decisions such as how to vote or whether to join the military. 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. 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.

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 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.