Kenneth Rosen, an economist and expert on real estate at the University of California, Berkeley, said that the boom was starting to hurt the “poor and middle class” but that it would benefit the “upper middle class.” Its full impact will not be felt for another couple of years, he said, adding, “We are early on in this boom.”

Mayor Lee said he would manage the city’s transition by furthering economic development while preserving its traditional qualities. Mr. Lee, who began his career as an advocate for the poor and housing rights, said his current priority — creating jobs — reflected his evolution on civil rights.

“I think the civil rights movement is no longer advocating from the outside,” he said. “It’s economic civil rights. You get people a job, you build their economic foundation, and then, if you set the right tone, they will start helping you build communities. We can’t do it with government-funded programs. We have do it with the private sector.”

With the tech industry generating most new jobs, Mr. Lee pushed through tax breaks for Twitter and other companies willing to move to downtown’s Mid-Market, a section with one of the city’s highest vacancy rates that he described as “our skid row.” Those breaks and others on stock options were necessary, he said, to keep rapidly growing start-ups from leaving the city and attracting new ones.

Twitter, which moved to its current location in another part of the city in 2009 with only 62 employees, plans to transplant its 800 San Francisco-based employees into its new 215,000-square-foot headquarters, said Karen Wickre, a company spokeswoman. The city estimates that Twitter may have 2,600 employees here within six years.

The tax breaks won Mr. Lee, a Democrat, the backing of Ron Conway, the venture capitalist who, despite being a longtime Republican, became one of the mayor’s biggest fund-raisers in his election to a full term in November. The move, Mr. Conway said, reflected San Francisco’s growing role in this tech boom, compared with the dot-com era during which the center of gravity was nearly an hour’s drive south, in Silicon Valley.

“Social media companies are tending to locate in cities so they can be in the audience, so to speak,” Mr. Conway said. Unlike dot-com companies, he added, most today are already profitable. “So this boom is going to be very, very sustainable and it’s going to have a permanent impact, a permanent positive impact, on the culture and economy of San Francisco.”