When Amazon told the country that it was going to anoint one winning city with 50,000 jobs, the announcement triggered excitement in city halls and statehouses across North America.

They mailed gifts, they created sports promotions, they filmed catchy videos featuring Amazon products. New York lit its skyscrapers Amazon orange. A small city in Georgia offered to hack off 345 acres from itself and rename it Amazon.

But when Amazon announced Tuesday that it would move 25,000 people each to New York and the suburbs of Washington, it was less clear who had won. The company, which eclipsed $1 trillion in stock market value for a time this year and is led by the world’s wealthiest person, extracted $2.4 billion in incentives from New York, Virginia and Tennessee, where it plans to open a 5,000-job operations center.

The concerns about Amazon’s process for selecting the winning cities — as well as the taxpayer subsidies it gained — underscore how the company’s furious expansion is inviting increasing political scrutiny. And as the company prepares to enter its 25th year in existence, the political risks aren’t likely to ease.

“Increasingly, Amazon will be challenged as being the big Goliath,” said Thomas Cooke, a professor at Georgetown University’s McDonough School of Business. “Attention will turn to Washington, D.C., and certainly Capitol Hill. . . . I can’t think of a better location to be in to fight those battles than to be in Washington.”

Many of the technology industry’s giants are facing extra political skepticism today. But Amazon is unusual in that it is becoming geographically entrenched across America — offering it potential grass-roots support — as it also becomes formidable in a number of sectors such as retail, government contracting and entertainment. Amazon is now the second-largest employer in the United States after Walmart, giving it access to more lawmakers, mayors and public officials whom it can try to influence and whose support it can try to enlist.

Indeed, in naming two new cities for additional headquarters, as well as a third major expansion, Amazon could gain additional support from at least six senators, three House members and many other local officials.

At the same time, Amazon is running up against political concerns in many dimensions of its business. President Trump has repeatedly questioned the company’s business arrangement with the U.S. Postal Service and its record on paying sales taxes. Liberals such as Sen. Bernie Sanders (I-Vt.) have criticized how it compensates workers. Others have raised alarms about whether it is becoming a modern-day monopoly, as well as its efforts to sell lucrative technology to the Immigration and Customs Enforcement agency and the Pentagon — efforts the company has strongly defended.

Amazon “is becoming a constituent of a number of senators and lawmakers,” said Stacy Mitchell, co-director of the Institute for Local Self-Reliance, an advocacy group that has raised concerns about overdependence on Amazon by municipalities. “This whole notion of ‘Amazon is going to be in one city’ ” was shortsighted, Mitchell said. “Amazon wants to be everywhere.”

The reaction to the new headquarters offers a microcosm of the challenges Amazon faces. Prominent political leaders hailed the decision, but others raised fears that the company had manipulated dozens of cities in a beauty contest that allowed it to gain valuable insights and extract economic concessions while ultimately landing in two of the most vibrant cities in America.

“Amazon is now treating even the biggest of American cities with the same disrespect it shows for the suppliers and the merchants who depend on its website to reach customers,” said Barry Lynn, executive director of the Open Markets Institute, a group that has raised concerns about excessive political power held by tech companies.

Amazon officials took pains, however, to stress that they were mainly motivated by the talent of the workforces in Washington and New York, and noted that they are building outposts in other cities, too. They said they were also sensitive to the notion that an influx of high-wage workers could have negative effects on local communities, after learning tough lessons in Seattle.

“One thing that’s different here is we are planning in advance with these cities. Amazon started in a garage. Nobody foresaw, not even Jeff, when they got launched that Amazon would become what it became or that we would have tens of thousands of employees in Seattle alone,” said Jay Carney, a former White House press secretary who now serves as Amazon’s senior vice president for global corporate affairs.

Amazon spent years avoiding Washington, running its operations a world away in Seattle, its hometown. Its biggest policy issue was whether it would pay local sales tax, which it had been able to avoid in the early age of the Web.

But in recent years, as it has sought to be a major player in multiple areas, it has stepped up its influence operations.

Amazon’s political action committee spent $1.8 million this campaign cycle, 16 times what it did 10 years ago. It has 102 lobbyists, including five former members of Congress, who focus on 24 policy areas — four times the 2008 number, according to the Center for Responsive Politics.

“It’s a pretty stark increase in the amount of money they’ve invested, both in terms of lobbying and in terms of campaign donations,” said Sheila Krumholz, the center’s executive director.

Amazon’s new footholds could help keep it closer to debates in Washington around whether the power held by tech companies is excessive. Companies such as Facebook and Google have been under intense scrutiny recently, and a generation ago Microsoft was sued by the government on antitrust concerns. Microsoft leaders famously recalled that they were slow to understand the importance of deepening connections in Washington.

Some experts now argue that Amazon, too, is growing into a kind of monopoly, one that can’t be reigned in under current antitrust law. But others argue that the company is nowhere near achieving pricing power for any of its businesses, from cloud computing to digital advertising to entertainment.

Amazon opened its own downtown lobbying office in 2014 and hired Carney in 2015.

Bezos has turned his focus to the Washington area as well, buying The Post in 2013. Three years later, he purchased the city’s largest home, a $23 million former museum, where he began a massive renovation, according to public filings.

He and other Amazon executives are backing Colorado Republican Sen. Cory Gardner’s 2020 reelection campaign. He and his wife, MacKenzie Bezos, also gave a $10 million gift this year to a super PAC focused on electing veterans across political parties to public office.

One area where Amazon’s presence in the Washington region could be particularly important is its work with the federal government — particularly in contracts servicing defense agencies. Amazon was the first company to meet the government’s secure-cloud-computing guidelines. And in 2013, the CIA awarded Amazon Web Services, its cloud-computing business, a $600 million contract.

Now, analysts say, Amazon is favored to win a $10 billion cloud contract from the Pentagon, as the Defense Department begins a long-term effort to build artificial-intelligence capabilities into its operations. The company may beat out Microsoft, IBM and Oracle.

Other would-be competitors, such as Google, have steered clear of supporting weapons systems, sometimes under pressure from employees over excessive contact with the military.

But Bezos has embraced working with the Pentagon. In February, Amazon chose Herndon, Va., — about 25 miles from Crystal City — for the long-term home of Amazon Web Services.

“If big tech companies are going to turn their back on the U.S. Department of Defense, this country is going to be in trouble,” Bezos said at a recent conference.

Of Amazon’s 613,000 global employees, 250,000 are hourly workers in the United States, and its expansion of shipping operations has provided a silver lining to some cities that lost on the new headquarters. In Charlotte, officials were so distraught at not making the list of 20 finalists for the project that the city reworked its economic development operation. The pain was softened when Amazon announced plans in June to open a $200 million distribution center there with 1,500 workers.

“It’s only when they got to this size, and they had to do things like build campuses in cities, that they realized they have to pay attention to the political stuff,” said Heather Redman, a Seattle venture capitalist and recent chair of the Seattle Metropolitan Chamber of Commerce.

Amazon has also quietly been growing its white-collar tech hubs, populated with the type of $150,000-plus-a-year jobs it promises for its headquarters expansion.

Most are already clustered in top coastal cities, with 7,000 in the San Francisco Bay area, 2,500 in the D.C. area, 1,500 in Los Angeles and more than 2,000 in New York, with another 2,000 on the way. Offices in Boston and Vancouver will roughly triple from 1,800 and 1,500 respectively in the coming years.

“They are making investments in these communities,” said Krumholz, from the Center for Responsive Politics. “They are providing jobs, which is a good thing. With that comes more defenders in Congress.”

For some analysts, the question is whether the new headquarters will be enough.

“Who’s to say five years from now we’re not looking at a third location or a fourth?” Cooke, the Georgetown professor, said.