The ordinance, authored by Mayor Gavin Newsom and co-sponsored by supervisors Ross Mirkarimi and Chris Daly, aims to help the city reach its goal of recycling 75 percent of its garbage.
The board approved the measure by a 9-2 vote. It requires all city residents and businesses to separate garbage into separate bins designated for recyclables, compost and trash. After a second vote from the board, the mayor could sign the ordinance later this month, and it would go into effect 90 days later.
Newsom's office said the law makes San Francisco the first city in the nation to require residents to separate food scraps and other compostable material.
"San Francisco has the best recycling and composting programs in the nation, and we've already attained an impressive, and first in the nation, 72 percent recycling rate because of them," Newsom said.
A study by the city's Department of the Environment found that more than a third of garbage San Franciscans send to landfills is compostable, most of it food scraps. The study also found that almost a third, mostly paper, is recyclable.
Newsom said if those materials were recycled or used for compost, the city's current recycling rate might hit 90 percent.
A main goal of the ordinance, according to Newsom, is to bring recycling and composting to buildings that don't currently provide it.
"Many tenants want to recycle and compost, but the building does not offer the service," Newsom said. "We're going to change that."
The ordinance allows for fines if residents or businesses don't comply, but Newsom said the fines are "primarily to heighten public awareness and encourage compliance," and would likely be rare.