NEW YORK — Just how nervous are investors about Greece? All it took to derail a day of stock market gains was a headline saying that the country was preparing to leave the euro, an outcome many analysts expect to happen eventually.
Major indexes were higher for most of the day after the National Association of Realtors reported that home prices surged 10 percent over the past year, the biggest gain in six years.
Then, with less than an hour of trading left, news hit that Greece’s former prime minister said the country was considering dropping the euro. Investors have been anticipating that Greece could make a messy exit from the euro this year, but the prospect that it could be imminent gave the market a jolt.
A 50-point gain in the Dow Jones industrial average turned into a 57-point loss in 45 minutes. A last-minute recovery left the Dow down just 1.67 points at 12,502.81.
Facebook’s stock kept sliding, dropping 9 percent to $31. The social networking company has fizzled since its long-awaited initial public offering last week at $38. Facebook sank 11 percent on Monday, even as the rest of the stock market rallied.
The realtor group said sales of previously occupied homes rose 3.4 percent last month to an annual rate of 4.62 million, more than economists had predicted. The median price jumped to $177,400, the biggest gain since January 2006, before the real-estate bubble popped.
“Existing home sales is one of the most important indicators for the housing market,” said Dan Greenhaus, chief global strategist at the brokerage BTIG. “The improvement in today’s data, while not spectacular, is nonetheless encouraging.”
In other trading, the Nasdaq composite dropped 8.13 points to 2,839.08. The Standard &Poor’s 500 inched up 0.64 of a point to 1,316.63. It was up 12 points earlier in the day.
PulteGroup, Lennar and other homebuilders gained more than 2 percent. S&P’s homebuilder index has surged 38 percent this year, versus 4.7 percent for the S&P 500 index.
In recent years, most analysts considered the housing market a drag on the overall economy. Chris Rupkey, chief financial economist at Bank of Tokyo-Mitsubishi, said Tuesday’s report is more proof that housing is no longer an obstacle. It’s “not just healing” he said, in a note to clients. Construction has now contributed to economic growth for two straight quarters.
Leaders of the 27 European Union countries will meet in Brussels on Wednesday. The summit is expected to focus on ways to bolster the region’s faltering economy and prevent a deeper financial crisis, though it’s unlikely they’ll produce any plans before Greece holds elections in June.
Among stocks making big moves:
— Urban Outfitters jumped 7 percent, the best gain in the S&P 500. The retailer posted earnings late Monday that surpassed Wall Street analysts’ expectations on record sales.
— Benihana soared 21 percent on news that the restaurant group’s board agreed to a buyout from the private equity firm Angelo, Gordon &Co. Shareholders still need to sign off on the deal.
— Ralph Lauren rose 3 percent. The clothing company’s quarterly earnings soared 29 percent, helped by strong sales and a lower tax rate. The company doubled its dividend to 40 cents per share.