Addressing the controversial and fast-growing practice of ad-hoc hotels in homes, San Francisco Board of Supervisors agreed to legalize but rein in short-term residential rentals by passing the so-called "Airbnb law" 7-4 Tuesday.

"The status quo isn't working; we have seen an explosion in short-term rentals," said Board President David Chiu, who spent over two years crafting the law.

The law allows only permanent residents to offer short-term rentals, sets up a new city registry for hosts, requires collection of the hotel tax, limits entire-home rentals to 90 days a year and establishes guidelines for enforcement by the Planning Department. It is slated to take effect February 2015.

For Airbnb, a six-year-old company based in San Francisco that has enjoyed explosive growth and is worth more than many major hotel chains, the legislation is a huge validation, legalizing its business model in its home town and clarifying what rules it must abide by.

Chiu and other supervisors said they sought a balance between preserving affordable housing — by making sure landlords can't convert permanent units to more-lucrative vacation rentals — and allowing residents to earn extra income by renting to travelers.

Although San Francisco has long barred residential rentals of less than 30 days, that law has been lightly enforced, even while thousands of residents turned to Airbnb, HomeAway, VRBO, Flipkey and other websites to rent their homes and rooms to travelers.

Supervisors grappled with several proposals to further restrict vacation rentals, including limiting "hosted rentals" to 90 days and requiring Airbnb to pay back taxes, but ultimately rejected those proposals. Suggestions that would allow nonprofits to quickly pursue violators of the new law will be introduced as "trailing legislation" in the future.

Supervisor David Campos, who is vying with Chiu for an Assembly seat in next month's election, proposed the most sweeping changes to the legislation. He called for the law to be frozen until Airbnb pays $25 million of back taxes — dating back to when the city treasurer ruled that vacation rentals are liable for the city's 14 percent hotel tax. "I believe it is only right that Airbnb make good on its overdue taxes before this legislation becomes law," he said. "We should ensure a multibillion-dollar company pays its fair share of taxes just like everyone else."

However, that amendment failed, 6-5.

Airbnb has said it will start collecting and remitting the hotel tax this month, something Chiu said was spurred by his legislation. Chiu said the law doesn't exempt anyone from paying taxes, whether back or forward, but that back taxes are the purview of the city attorney and treasurer.

Airbnb, a six-year-old company based in San Francisco, has about 5,000 rentals here, two-thirds of them in entire homes, according to a Chronicle analysis. Scores of its hosts spoke at public meetings and rallies over the past several months, saying that vacation rentals helped them make ends meet. But a broad coalition of groups, including housing advocates, landlords, neighborhood associations and labor, also showed up in force to express concerns that vacation rentals were diverting housing units, raising prices, and threatening tenant security and quality of life.

Voting in favor of the new law were supervisors Chiu, Mark Farrell, Malia Cohen, Katy Tang, Scott Weiner, London Breed and Jane Kim. Supervisors John Avalos, David Campos, Norman Yee and Eric Mar voted against it.

Carolyn Said is a San Francisco Chronicle staff writer. E-mail: [email protected] Twitter: @csaid