NEW YORK — Companies that do well when the economy is improving led the market higher Tuesday after several of them notched strong earnings.

The markets closed higher even after stocks and other markets were shaken in the early afternoon when a fake tweet on the AP’s Twitter account prompted a sudden sell-off.

A posting saying that there had been explosions at the White House and that President Barack Obama had been injured was sent at 1:08 p.m. The Dow immediately plunged about 143 points, from 14,697 to 14,554. The AP said its Twitter account had been hacked and the posting was fake.

Within five minutes the Dow had snapped back.

Coach, a maker of luxury handbags, and Netflix, which streams TV shows and movies over the Internet, were big winners after reporting profits that impressed investors. Financial stocks rose after Travelers’ earnings beat analysts’ expectations. Coach soared $4.96, or 11 percent to $55.55. Netflix soared $42.62, or 24 percent, to $216.99. Travelers rose $1.77, or 2.1 percent, to $86.35.

That’s a change from earlier this year. The stock market’s surge in 2013 has been led by so-called defensive industries such as health care, consumer staples and utilities. Investors buy those stocks when they want reliable earnings and regular dividends. Until now, they have been unsure about the strength of the economic recovery and been less enthusiastic about stocks whose fortunes are more closely tied to swings in the U.S. economy.

“For a change, we are actually seeing more cyclical parts of the economy lead the market,” said Michael Sheldon, chief market strategist at RDM Financial Group.

On the economic front, U.S. sales of new homes rebounded in March to a seasonally adjusted annual rate of 417,000.

The increase added to evidence of a sustained housing recovery at the start of the spring buying season. The Commerce Department says that sales of new homes increased 1.5 percent. The gain brought the level higher than February’s pace of 411,000, though below January’s 445,000 — the fastest pace since July 2008.

The Dow closed up 152.29 points at 14,719.46. The S&P 500 ended 16.28 points higher at 1,578.78. Both indexes are about 1 percent below their record high closes from nearly two weeks ago.

The Nasdaq composite rose 35.78 points, or 1 percent, to 3,269.33.

A resurgence in corporate profits after the Great Recession has been one of the drivers that pushed the Dow up 12 percent and the S&P 500 up 11 percent this year. Tuesday’s upturn in stocks put both indexes back in the black for April and closer to the record high closes they reached on April 11.

It was a sharp change of tone from last week, when the market had its worst drop since November. That sell-off started after economic growth in China, the world’s second-largest economy, slowed.

So far, 69 percent of the companies that have reported earnings for the first quarter have beaten analysts’ expectations, better than the 10-year average of 62 percent, according to data from S&P Capital IQ.

Analysts expect earnings to rise by 2.3 percent in the first quarter, slower than the 7.7 percent growth in the previous three-month period.

In other news:

DELTA AIR LINES: It got a little carried away with fare increases and had to adjust its pricing during the first quarter. It worked, and the airline posted its biggest profit for the January-March quarter since 2000.

US AIRWAYS: The nation’s fifth-largest airline posted a bigger adjusted profit as it carried more passengers, and collected more from them.

DISCOVER FINANCIAL: Its first-quarter net income rose 2 percent, boosted by loan growth.

DUPONT: Net income more than doubled in the first quarter on a gain from the sale of its performance coatings unit and strong continuing results in its agricultural unit.

REYNOLDS AMERICAN: First-quarter profit jumped 88 percent as higher prices and lower expenses from a longstanding legal settlement offset a decline in cigarette sales.

YUM BRANDS: KFC and Taco Bell’s parent reported a better-than-expected net income for its first quarter even as it struggled to overcome a controversy over its chicken suppliers in China.

NORFOLK SOUTHERN: First-quarter profit improved 10 percent as an increase in railroad shipping volume and a land sale helped offset continued weak coal demand.

AMGEN: The biotech giant says its first-quarter profit rose 21 percent on higher sales of drugs to treat arthritis and osteoporosis.

FEDEX: It will let recipients leave detailed instructions for their driver or reschedule a delivery to their home. The company says it also will charge $5 to reschedule the delivery day or location and $10 to request a two-hour delivery window.

AT&T: It says that it added a net 296,000 devices to its contract-based plans in the first quarter, but the gain was due entirely to tablets, which carry lower monthly fees. Excluding tablets, the carrier lost a net 69,000 devices from its contract-based plans, the first such loss.

BLACKBERRY: The maker of the BlackBerry expects its Q10, the new version of its phone with a physical keyboard, will be available in the U.S. by the end of May.