NEW YORK (AP) -- U.S. stocks swerved between gains and losses Thursday and wound up with a muddled finish as the price of oil plunged. Investors also sold utility and phone company stocks. They have favored those companies all year, especially in the wake of Britain's vote to leave the European Union last month.
Stocks started higher, building on gains from the previous day. But they fell after a government report that showed oil stockpiles did not shrink as much as investors had hoped. Investors sold government bonds after buying them at a rapid clip earlier this week, and precious metals prices also slid. Energy companies were hammered as the price of oil dropped almost 5 percent.
Nate Thooft, head of global asset allocation for Manulife Asset Management, noted that stocks and oil prices have often traded in tandem this year.
"Where oil goes, stocks go," he said. "Oil fell dramatically pretty quickly."
The Dow Jones industrial average fell 22.74 points, or 0.1 percent, to 17,895.88. The Standard & Poor's 500 index slid 1.83 points, or 0.1 percent, at 2,097.90. The Nasdaq composite rose 17.65 points, or 0.4 percent, to 4,876.81. The Dow rose as much as 66 points in the morning and fell as much as 102 points in the afternoon.
The price of oil fell after the Energy Information Administration said crude oil inventories shrank by 2.2 million barrels last week. Analysts expected a bigger drop of 2.6 million barrels, according to S&P Global Platts. Inventories have been at historically high levels lately as the supply of oil outstrips demand.
Investors sold some of the safest groups of stocks.
Duke Energy shed $1.94, or 2.2 percent, to $85.29. Xcel Energy lost $1.01, or 2.2 percent, to $44.32. AT&T fell 80 cents, or 1.9 percent, to $42.30. The S&P 500's utility and phone company indexes have both climbed 20 percent this year. Bond prices dipped. The yield on the 10-year U.S. Treasury note rose to 1.39 percent from 1.37 percent. The yield on the 30-year Treasury note remained around 2.14 percent. Both notes have set all-time lows over recent days.
Gold, which is trading at its highest price in more than two years, lost $5 to $1,362.10 an ounce. Silver lost 37 cents, or 1.8 percent, to $19.84 an ounce. Copper shed 3 cents to $2.12 a pound.
Benchmark U.S. crude lost $2.29, or 4.8 percent, to $45.14 a barrel in New York. Brent crude, used to price international oils, lost $2.40, or 4.9 percent, to $46.40 a barrel in London. In the morning oil prices rose almost 2 percent.
Exxon Mobil fell $1.13, or 1.2 percent, to $92.96 and Chevron retreated $1.53, or 1.5 percent, to $103.05.
Organic food maker WhiteWave Foods jumped after French yogurt giant Danone agreed to buy the company for $56.25 a share, or about $10 billion. The deal would expand Danone's range of health foods and the U.S. market. WhiteWave gained $8.80, or 18.6 percent, to $56.23.
Dutch anti-virus software company AVG Technologies surged after rival Avast Software agreed to buy it for $25 a share, or $1.3 billion. AVG stock advanced $5.79, or 30.8 percent, to $24.58.
Health insurers Aetna and Humana slumped as investors worried that the government will stop the companies from combining. Aetna, the third-largest U.S. health insurer, agreed to buy Humana last year for about $35 billion in cash and stock. But the companies can't complete the deal without approval from the Department of Justice.
Humana stock dropped $17.24, or 9.6 percent, to $162.74 and Aetna skidded $4.77, or 4 percent, to $115.47.
Investors are looking at reports showing healthy hiring. A survey by payroll processor ADP said private U.S. companies added 172,000 jobs in June, a sign hiring may have picked up again after it slowed down in April and May. Meanwhile the U.S. government said weekly applications for unemployment benefits fell last week, another sign employers continue to hire more workers. The government will release its own jobs report on Friday.
"There's a general consensus that there's going to be a bounce-back for June," Thooft said. He said stocks could trade lower if the results are disappointing, but added that if the report is solid or better than expected, investors might wonder if that will encourage the Federal Reserve to raise interest rates.
Costco stock gained $7.69, or 4.9 percent, to $163.70 after investors were pleased with the warehouse club operator's June sales.
Hard drive maker Western Digital forecast stronger results for its fiscal fourth quarter after it acquired flash memory chip maker SanDisk in May. Western Digital stock rose $2.20, or 4.8 percent, to $47.66.
In other energy trading, wholesale gasoline lost 7 cents, or 4.9 percent, to $1.36 a gallon. Heating oil fell 6 cents, or 4.1 percent, to $1.41 a gallon. Natural gas lost 1 cent to $2.78 per 1,000 cubic feet.
Britain's FTSE 100 rose 1.1 percent, France's CAC 40 added 0.8 percent and Germany's DAX increased 0.5 percent. Japan's benchmark Nikkei 225 index slipped 0.7 percent. South Korea's Kospi climbed 1.1 percent and Hong Kong's Hang Seng rose 1 percent.
The dollar declined to 100.76 yen from 101.40 yen. The euro fell to $1.1055 from $1.1105. The British pound declined to $1.2896 from $1.2922. It's been trading at 30-year lows over the last few days.