SAN FRANCISCO — Voters in San Francisco approved a tax increase on the city’s largest businesses that would nearly double its budget for homeless services, a measure seen as an effort to hold wealthy technology companies accountable for exacerbating the local housing crisis.

Tech executives have poured money into the campaigns for and against the measure. Jack Dorsey, the chief executive of Twitter and the payments company Square, spent $125,000 to oppose it, while Marc Benioff, the chief executive of Salesforce, spent $2 million to support it. Salesforce contributed an additional $5 million to the campaign in favor of the initiative, known as Proposition C.

Mr. Benioff and Mr. Dorsey sparred on Twitter over Proposition C in October, fueling a debate that coursed through the tech industry in the run-up to the election. The battle continued in the days before the vote, with Mark Pincus, the co-founder of the online gaming company Zynga, tweeting Saturday that Proposition C is “the dumbest, least thought out” initiative and asking his followers to vote against it.