The ordinance, introduced by Supervisor Eric Mar, was approved this afternoon by a 10-0 vote, but only after several amendments were made in recent weeks, intended to appease businesses.
Mar said it was a "difficult," lengthy campaign, but insisted the final measure "will protect thousands of San Franciscans from the dangers of secondhand smoke."
It will ban smoking in outdoor restaurant dining areas, enclosed common areas of multi-unit housing, farmers markets, homeless shelters and charity bingo games.
It also prohibits smoking in service waiting areas, such as lines for ATMs, concerts, movie theaters, sporting events, taxis and bus stop shelters, and within 15 feet of business doorways.
Smoking is still allowed in private homes and on city streets and in existing bars that have semi-enclosed outdoor smoking areas.
Smoking inside bars is already prohibited under state law.
Current city law already prohibits smoking in city buildings, businesses, schools, hospitals and public transit.
Dr. Mitch Katz, director of the city's public health department, said today that other communities that have passed similar laws have seen a drop in deaths due to cardiac disease.
"So by passing this ordinance, you are all saving lives," he told the supervisors.
Karen Licavoli of Breathe California, one of the anti-tobacco groups working on the measure, acknowledged some concessions had been made to local businesses, but said "there's still a number of protections in there."
"It's what we can do; it's a political reality," she said.
According to Licavoli, enforcement of the measure will likely be complaint-driven. She said the main intent is to change smoking behavior.
"We're not trying to be smoking police, we're just trying to set a different norm around what are appropriate smoking areas," Licavoli said. "People complain all the time about having to walk through a gauntlet of smoke. This is just trying to mitigate that."