Amazon.com Inc.’s announcement that it is ditching plans for a corporate headquarters in New York City stunned real-estate speculators, developers and renters who had rushed into the Long Island City neighborhood to be near the new HQ2.

Only three months ago, the prospect that the giant retailer would locate a headquarters in New York City and create 25,000 new jobs set off a real-estate frenzy that the borough of Queens had never experienced.

...