San Francisco is now the second largest city after New York City to change the legal tobacco buying age from 18 to 21.
The city's Board of Supervisors voted unanimously for the change on Tuesday amid opposition from people who argued that city laws should not be able to trump state laws. In California, the legal age to buy tobacco is 18.
The executive director of the National Association of Tobacco Outlets, Thomas Briant, had asked the supervisors to postpone voting on the legislation until the state Attorney General Kamala Harris issues a decision.
Briant argued that since 18-year-olds are legal adults who can vote, enlist in the army and sign contracts, they should be allowed to choose whether or not they want to buy tobacco products. Eighteen-year-olds in California can also legally get a medicinal marijuana card from licensed physicians.
Harris' spokeswoman stated that the attorney general does not have a legal opinion pending for this issue.
The city's attorney, however, said the ordinance, which applies to all tobacco products, including e-cigarettes, was legally sound.
Supervisor and chief sponsor of the legislation, Scott Wiener, hopes that by increasing the legal purchasing age, fewer people from the younger generation would become daily smokers.
A 2015 report by the Institute of Medicine found that about 90 percent of adults who smoke everyday had their first cigarette before the age of 19 and that 100 percent of adult smokers smoked their first cigarette before 26.
The U.S. Centers for Disease Control and Prevention (CDC) reported that tobacco is still the number one leading preventable cause of death and disease within the country. Cigarette smoking in particular kills more than 480,000 Americans per year, while cigarette-related illnesses cost the U.S. more than $300 billion per year.
The new legislation will go into effect on June 1.