GE is moving to city as roughly 14 million square feet of new space is being added.

General ElectricCo. Chief Executive Jeffrey Immelt on Monday joined Boston Mayor Martin Walsh and other government leaders to celebrate the groundbreaking of the company’s new headquarters, the most vivid sign so far of a historic real-estate boom gathering steam in New England’s biggest city.

GE is moving its headquarters to Boston from Fairfield, Conn., at a time when roughly 14 million square feet of new space is being developed elsewhere in the city. That doesn’t count the 40 million square feet of permitted projects that haven’t broken ground yet.

About 80% of the new development consists of rental apartments and condominiums. Most of the rest is office space.

“This is the biggest building boom in the history of the city,” said Brian Golden, director of the Boston Planning & Development Agency.

Developers who caught the wave early—including major U.S. firms and foreign investors—have made handsome profits. For example, a partnership led by Tishman Speyer that had invested $535 million into an office project known as One Federal Street just refinanced it in a deal that valued it at $705 million.

A venture of Related Cos. of New York and Beal Cos. of Boston, meanwhile, converted a derelict candy warehouse into a new headquarters for NikeInc.’s Converse unit, which relocated about two years ago from Andover, Mass. Last year the venture sold the property to Union Investment, a German fund, for $150 million.

But there also are signs of growing pains and concerns of a space glut in Boston. Many of the residential units under construction are luxury high-rise rentals and condominiums, a relatively untested market in Boston, where most of the housing is low-rise.

The office vacancy rate has mostly been dropping from its postcrash high of 14.5%, according to real-estate firm JLL. But in the first quarter of this year, it increased to 14% from 13.7% in the same period a year earlier as new space was added and tenants moved into more efficient offices.

Most concerning to planners, Boston is facing a shortage of middle- and low-income housing as affluent workers and others bid up the price of market-rate apartments and houses. Mayor Walsh is ahead of schedule on his plan to add 53,000 units by 2030, but it hasn’t been easy.

The effort has triggered opposition in neighborhoods where residents are worried about being displaced by market-rate housing. “It’s a real struggle for us,” said Mr. Golden, who pointed out that 17% of the 3,607 units completed in 2016 were considered affordable, or below market rate.

Boston’s boom is partly rooted in the growing popularity of city living, a national trend that has boosted downtowns in many cities. In the past six years, Boston’s population has added 50,000 people, or about 8%, more than all of the previous three decades. The region’s 55 educational institutions make Boston an appealing location for a wide range of businesses.

When GE announced its plans to move there last year, Mr. Immelt pointed to Massachusetts’ high spending on research and development.

“We want to be at the center of an ecosystem that shares our aspirations,” he said. Boston also gave GE tax incentives to move there.

Planners also credit a mammoth infrastructure project known as the “Big Dig” that rerouted a major highway artery underground. Completed in 2007 at a cost of nearly $15 billion, it was widely criticized at the time for delays and for going way over budget. But today the city is enjoying the benefits of new parks and more walkable connections between downtown and waterfront.

GE is moving its headquarters to two historic, redbrick buildings and a new 12-story building on 2.4 acres in the revived waterfront area that used to be cut off from the downtown by a highway.

So far, rental and condo markets are holding up despite the thousands of new units being added, according to brokers. Last year, there were 3,708 sales of condos and single-family homes in core downtown Boston neighborhoods, up from 3,467 in 2015, according to a report by Joe Wolvek of Gibson Sotheby’s International Realty. The median sales price rose to $791,000 from $685,000, the report said.

Rents also are rising, according to developer Steve Samuels, who has developed hundreds of rentals and currently is building the 30-story Pierce Boston project in the Fenway Park neighborhood. High-end apartments in the neighborhood today go for the upper $2,000s to the mid-$3,000s in rent a month, up roughly 2.5% from a year ago, he said.

At the ultraluxury end of the market, the $900 million One Dalton development will include a Four Seasons hotel and 160 condos priced between $2.7 million and $40 million. Developer Richard Friedman agreed that such high-rise luxury-living is “very new for Boston,” where residents tend to be less flashy than other cities and are “more likely to be driving a Prius than a Rolls-Royce. ”

Mr. Friedman declined to reveal sales numbers. But one of the most expensive units has been sold already, setting a record for Boston, according to people familiar with the matter.

Meanwhile, the office market is beginning to see an increase in so-called speculative developments that are launched before most tenants have signed on, according to a report by JLL. Only 37% of the space under construction is pre-leased, the report said.

Given the strength of the leasing market, those buildings probably won’t face problems, according to Benjamin Heller, director of JLL’s downtown Boston team. “The buildings that are going to have the hardest time adjusting are older towers built in the 1970s and 1980s,” he said.

“All those owners are trying to figure out what kind of investments they need to make to stay relevant,” Mr. Heller said.