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.

Benioff and 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.

What message is Amazon sending by helping kill a new tax in Seattle?

Benioff argued that San Francisco’s businesses needed to take a more aggressive role in dealing with the city’s homelessness crisis.

“What we do matters and we can improve the world,” Benioff said. “We can’t just be part of the problem.”

The final results showed that three of every five people who voted supported the measure.

“I think what’s been so incredible about this measure is we’ve seen an overwhelming amount of support from the community,” said Sam Lew, the manager of the campaign favoring the initiative. “If there is a legal challenge, there will be thousands of San Franciscans who will fight against it.”

Opponents of the measure may challenge the results. A state Supreme Court ruling last year raised questions about whether tax increases proposed by voters for specific causes needed the same two-thirds majority to pass as those proposed by elected officials.

The San Francisco City Attorney’s Office is currently seeking a court order to resolve the confusion, asking the city’s Superior Court to affirm that special tax increases proposed by voters can be passed with a simple majority vote.

Jess Montejano, a spokesman for the No on C campaign, expressed confidence that Proposition C’s failure to meet the two-thirds threshold meant it would never go into effect.

“Despite outspending the No on C campaign by at least 4-1, the Yes on C campaign failed to earn the two-thirds voter support necessary for San Francisco to ever see a penny that Proposition C promised,” Montejano said.