Amazon.com Inc. will build new offices in New York City and Arlington, Va., ending months of jockeying between potential locations across the country vying for a $5 billion investment that promises 50,000 high-paying jobs over almost two decades.

Amazon also said it will create more than 5,000 jobs in Nashville, Tenn., at a new operations center that’s responsible for fulfillment, transportation, supply chain and other activities.

The anti-climactic ending to a more than year-long search — multiple office projects rather than a single second headquarters — shows Amazon thinks it’s better to tap multiple labor markets for future growth rather than try to house everyone in one city.

The sites in Long Island City in the borough of Queens, and in the Crystal City section of Arlington, will be a boon for the New York and Washington metro areas and highlights Amazon’s willingness to target big talent pools with pricey payroll over smaller markets offering lower costs of living. It’s a disappointment for the 18 other cities, including Toronto and Chicago, many of which offered billions of dollars in tax breaks to lure the world’s largest internet retailer.

Long Island City will be home to one of the two new headquarters. (Christopher Lee/Bloomberg News)

Amazon captured North America’s attention in 2017, when it announced plans to build a second headquarters, prompting gushing overtures from politicians and publicity stunts from hopefuls eager to stand out. A group from Tucson offered to send a 21-foot-tall cactus to Seattle, which the company donated. A Georgia town offered to name a new city “Amazon.” Beyond hype, cities dangled generous tax incentives. Former New Jersey Gov. Chris Christie publicly offered $7 billion in tax breaks and other benefits to bring Amazon to Newark. Most cities and states kept their offers private.

Since Amazon pared the list to 20 cities in January, speculation has been rampant, with lists handicapping supposed frontrunners. Amazon had a broad list of criteria, including a population of 1 million, proximity to a major airport and a strong university system, without clearly identifying which factors were most important. Many guessed Amazon wanted to be close to Washington, because three of the finalist sites were clustered around the nation’s capital. Another theory was that Toronto — the only Canadian city on the list — might be chosen to serve as a hedge against President Donald Trump’s policies limiting immigration. Amazon is a frequent target of Trump’s criticism.

A robust talent pipeline and room to grow — not big financial incentives — helped push Arlington to the top of Amazon’s list, said Victor Hoskins, head of the county’s economic development agency. The Washington area stood out with a large educated workforce of three million people and a transit system that has plenty of capacity.

Crystal City, Arlington, Va., struck a deal with Amazon and will see as many as 25,000 jobs added over the next decade. (Andrew Harrer/Bloomberg News)

In negotiations and multiple visits over the past year, Amazon wanted to make sure the community had space for its new offices and a transportation system that could handle shuffling them around, he said. From the county, Amazon will get a portion of hotel taxes expected to be $23 million over the next 15 years. Amazon generates 300,000 hotel stays a year in Seattle, Hoskins said. The state offered additional incentives.

The search was also a not-so-subtle message to the city of Seattle, where some political leaders have blamed Amazon for skyrocketing property values, gridlocked highways and a growing homeless crisis. Tension between Amazon and the city spilled into the public spotlight earlier this year, when the city council approved and then overturned a payroll tax on big employers to pay for affordable housing and programs to fight homelessness. Amazon, the city’s dominant employer, threatened to push growth elsewhere if it was approved.

Now New York and Virginia face the challenge of balancing the benefits of Amazon’s investment with the growing pains that can come with fast expansion and an influx of wealth. The company has helped fuel a tech boom in Seattle, where cranes building new office towers, apartment buildings and hotels dot the skyline.

New York will get more than 25,000 full-time, high-paying jobs, about $2.5 billion in Amazon investment; 4 million square feet of energy-efficient office space with the chance to expand to 8 million square feet.

And while New York’s top politicians enthusiastically wooed Amazon, some local lawmakers said the $808 billion company shouldn’t receive “massive corporate welfare” in order to invest in the city and instead should use its resources to help solve public problems such as aging subways.

In its release, Amazon said New York will get more than 25,000 full-time, high-paying jobs, about $2.5 billion in Amazon investment; 4 million square feet of energy-efficient office space with the chance to expand to 8 million square feet; and an estimated incremental tax revenue of more than $10 billion over the next 20 years. Amazon will receive $1.5 billion if it meets its job-creation goals.

Amazon also agreed to donate space on its campus there for a tech startup incubator and for use by artists and industrial businesses; the company will also donate a site for a new public school. It also pledged to invest in infrastructure improvements and new green spaces.

“I said we would build a new New York State — one that is fiscally responsible and fosters a business climate that is attractive to growing companies and the industries of tomorrow,” New York Gov. Andrew Cuomo said in the statement from Amazon.

Arlington will benefit from the same number of jobs, investment and office space as Long Island City. The site will also benefit from an estimated incremental tax revenue of $3.2 billion over the next 20 years as a result of Amazon’s investment and job creation. Amazon will receive $573 million in incentives if it meets the job-creation pledge.