Image copyright EPA Image caption Long Island City, where Amazon is planning expansion along the East River, is one of the fastest growing areas in New York

Amazon plans to build major new campuses in New York City and next to the Pentagon near Washington DC, and expand its operations in Nashville.

The decision comes 14 months after the tech giant kicked off a continent-wide competition by announcing a search for a "second headquarters" location.

The contest drew 238 bids, as local officials leapt at the chance to land a potentially transformative investment.

The three locations could create some 55,000 jobs in the next two decades.

Amazon said it expected to invest about $2.5bn each in New York and Arlington, where the offices are planned to host more than 25,000 "high-paying jobs".

It said Nashville, Tennessee would become Amazon's new East Coast hub of operations, creating another 5,000 positions.

In exchange, the e-commerce giant is due to receive more than $2bn (£1.9bn) worth in tax benefits and other incentives from the state and local governments.

How did it make its decision?

Amazon had originally said it was looking to build a single "HQ2" in a large urban area, with proximity to a major airport and access to mass transit.

The company said at the time that the new premises would create as many as 50,000 jobs and cost at least $5bn to build and operate.

However, Amazon eventually decided to split the jobs and investment between two different locations.

Image caption Amazon's offices in New York and Arlington are expected to host about 25,000 workers

On Tuesday, the firm said the division would allow it to "attract more top talent", especially in software development, when hiring starts in 2019.

What was the reaction?

Shares in property companies expected to benefit shot up after rumours of Amazon's selections circulated this month.

On Tuesday, top politicians in New York and Virginia cheered the announcement, while property firms reported surging interest in the two neighbourhoods.

Skip Twitter post by @MarkWarner As a former Governor, now Senator, but also as a former technology executive, I'm really excited about the potential Amazon offers not only to Northern Virginia but the whole capital region and the entire Commonwealth. — Mark Warner (@MarkWarner) November 13, 2018 Report

Others voiced worries that the influx of workers would drive up housing costs, crowd highways and otherwise strain local resources, as Amazon's expansion has in its hometown of Seattle, where it employs more than 45,000 people.

Alexandria Ocasio-Cortez, a newly elected member of Congress who represents Long Island City, the New York neighbourhood Amazon has chosen, said her office had received numerous calls from constituents expressing "outrage" about the deal.

Skip Twitter post by @AOC Amazon is a billion-dollar company. The idea that it will receive hundreds of millions of dollars in tax breaks at a time when our subway is crumbling and our communities need MORE investment, not less, is extremely concerning to residents here. — Alexandria Ocasio-Cortez (@AOC) November 13, 2018 Report

So what about those tax incentives?

Amazon is due to receive more than $1.7bn in incentives from New York, and more than $500m from Virginia, benefits tied to Amazon's delivery of its promises for jobs and investments.

Some of the funds will go to improve transport, parks and other infrastructure in the neighbourhoods.

Still, New York State Senator Michael Gianaris said the decision to offer tax incentives was a "a huge mistake", given the needs of the city's schools and subway system.

"To take precious public resources and give it to a company that's probably the last one on earth that needs it - Amazon - is a horrible decision and a great statement of misplaced priorities," he told the BBC.

Amazon, which has already won millions in public subsidies, is known for driving a hard bargain.

However, some of the other locations hoping for the nod had offered even more than the two winners, thriving regions where many major US companies, including Amazon, already have a presence.

Analysts said Amazon's selection shows that subsidies sweeten - but do not necessarily drive - corporate decisions.

In this case, the ability to recruit highly educated workers seemed to be the top concern, said Mark Muro, a senior fellow at the Brookings Institution, a think tank in Washington.

The outcome "suggests that there were only two places they could go," he told the BBC.

"It does remind that the subsidy game is often doomed, or often leads to disappointment."

What does the decision say about the US economy?

Image copyright Reuters Image caption The area of Arlington, VA selected by Amazon is close to the Pentagon and Reagan National Airport

Since the 1980s, tech companies have clustered in a handful of coastal cities in the US, helping to fuel a growing economic gap between those areas and the rest of the country.

Google, for example, is also planning a major expansion in New York.

While Amazon initially appeared to be casting its net wide, its final selection will reinforce those trends, said Mr Muro.

Losers on the firm's 20-city short list included Newark in New Jersey, Columbus in Ohio and Miami in Florida.

"It's in a way a missed opportunity for the nation to channel major new investment into new places, especially ones in the heartland," he said.

"The digital economy for now at least is organised around superstars," Mr Muro said. "This is about the big getting bigger, the strong getting stronger, the rich getting richer."