NEW YORK (AP) — Stocks wavered between small gains and losses on Thursday to close little changed as traders weighed generally strong earnings reports against the falling fortunes of energy companies.
Indexes rose from the opening of trading following encouraging quarterly results from Wal-Mart Stores and the media giant Viacom, then flitted up and down most of the day. After four weeks of healthy gains for stocks and a series of record daily closes, the tepid trading was not unexpected.
"After a move higher so far, so fast, the market needs a pause," said Quincy Krosby, a market strategist at Prudential Financial. "We need another catalyst to move higher."
All three major U.S. indexes closed higher after a late-afternoon rally. The Dow Jones industrial average rose 40.59 points, or 0.2 percent, to 17,652.79, a record. It was the seventh record close for the blue-chip index in eight trading days.
The Standard & Poor's 500 index rose 1.08 points, or less than a tenth of a percentage point, to 2,039.33. The Nasdaq composite rose 5.01 points, or 0.1 percent, to 4,680.14.
A slump in the energy sector held back the overall market as oil prices continued to slump over fears that supplies will outstrip demand. Benchmark U.S. crude lost 4 percent and is trading at a four-year low.
Energy stocks closed down 1.4 percent. They had fallen more 2 percent, but got a boost by a late-day report from the Wall Street Journal that Halliburton is in talks to buy rival oil-field service company, Baker Hughes, citing unnamed sources. Baker Hughes soared $7.77, or 15 percent, to $58.75.
In other deal news, DreamWorks Animation jumped 14 percent on a New York Times report that the toy maker Hasbro is trying to buy the movie studio. And Berkshire Hathaway, run by billionaire Warren Buffett, said it was buying the Duracell battery business from Procter & Gamble in a deal valued at about $3 billion.
Jim Russell, a portfolio manager at Bahl & Gaynor, an investment firm, said the deal making helped keep stocks positive for the day.
"It's another source of demand for stocks, and presumably from smart buyers," he said. "It's lent some optimism to the market."
Among other stocks making big moves:
— Wal-Mart jumped $3.74 to $82.94 after reporting earnings and revenue that were higher than financial analysts had expected. The 4.7 percent gain was the biggest in the Dow.
— Viacom, which owns the Paramount studio, MTV and VH1, rose $1.95, or 2.8 percent, to $71.20 after its results topped forecasts.
— Amazon rose 1.6 percent following news that it had resolved a bitter, long-running dispute with the book publisher Hachette. Amazon stock gained $4.97 to $316.48.
Benchmark U.S. crude fell $2.97 to close at $74.21 a barrel on the New York Mercantile Exchange. Brent crude, a benchmark for international oils used by many U.S. refineries, fell $2.46 to close at $77.92 a barrel, also a 4-year low, on the ICE Futures exchange in London.
In other energy futures trading on the NYMEX:
— Wholesale gasoline fell 10.5 cents to close at $2.002 a gallon.
— Heating oil fell 8.5 cents to close at $2.362 a gallon.
— Natural gas fell 20.8 cents to close at $3.977 per 1,000 cubic feet.
In metals trading, the price of gold edged up $2.40 to $1,161.50 an ounce. Silver was flat at $15.62 an ounce and copper fell three cents to $2.99 a pound.
U.S. government bond prices rose slightly. The yield on the 10-year Treasury note slipped to 2.34 percent from 2.36 percent on Wednesday.