NEW YORK (AP) -- Stocks slipped Thursday as a three-day rally ran out of steam. A surge in oil prices also slowed down, and consumer stocks fell after Wal-Mart reported disappointing sales and cut its projections for the year.
The losses were small but spread across many industries. Energy stocks fell the most, followed by banks. Those stocks had made big gains over the last three days as the market rallied. Wal-Mart's weak results put pressure on other retailers as well as supermarket chains.
The Dow Jones industrial average gave up 40.40 points, or 0.3 percent, to 16,413.43. The Standard & Poor's 500 index lost 8.99 points, or 0.5 percent, to 1,917.83. The Nasdaq composite index slid 46.53 points, or 1 percent, to 4,487.54.
Wal-Mart's profit fell compared to last year and its sales were weaker than analysts expected. The retailer now says its net sales this year will be about the same as in 2015. It's struggling with competition from online giant Amazon and other retailers and is also paying its employees more, which has reduced its profits. In January the company said it would close 269 stores.
On Thursday the stock lost $1.99, or 3 percent, to $64.12. It's down 26 percent over the last year.
Wal-Mart is the first major retailer to report its quarterly results. Competitors including Target, JC Penney and Macy's will follow next week. Retail consultant Walter Loeb said he thinks most of those competitors will also report disappointing results.
"There are many, many retailers who have not been proactive in keeping their expenses in check," he said, adding that weakening sales growth makes that a bigger problem. Loeb said consumers are spending cautiously because they are worried about job security and aren't sure if the U.S. economy will keep growing.
J.C. Penney lost 20 cents, or 2.6 percent, to $7.63 and Costco fell $2.26, or 1.5 percent, to $148.65. Wal-Mart's struggles also affected supermarkets, as the company noted that meat and dairy prices are down. Kroger fell $1.35, or 3.5 percent, to $38.06.
Oil prices fluctuated after a big rally over the last few days. Investors are hoping that a round of international talks will lead to a deal that addresses a glut in oil production, but the U.S. government reported that energy stockpiles are still growing.
U.S. crude added 11 cents to close at $30.77 a barrel in New York. The price of U.S. oil has climbed 17 percent over the last week. Brent crude, a benchmark for international oils, lost 22 cents to close at $34.28 a barrel in London.
With oil prices trading around 13-year lows, at least six OPEC nations have backed a plan that would stop oil production from increasing any further. That would help address a giant supply glut. Iran, which has not agreed to the deal and has said it wants to keep increasing its production, said it supports any measure to raise oil prices.
Investors saw that as a good sign, but the deal won't go into effect unless all 13 OPEC members agree to it. Meanwhile, stockpiles keep growing. According to an Energy Information Administration report, oil inventories grew by 2.1 million barrels and gasoline stockpiles increased by 3 million barrels.
Independent analyst Jim Ritterbusch said people are driving a bit more because the price of gas has plunged, but it's not a big change, so it's not helping improve prices.
"It looks like gasoline demand is still soft," he said. "You can only buy and sell so many SUVs."
While oil companies have shut down hundreds of oil drilling rigs, it will be months before oil production really slows down because drilling operations have become much more efficient, Ritterbusch said.
The S&P 500 jumped more than 5 percent over the past three days, with banks and consumer stocks making the biggest gains. That rally erased about half of the index's losses since the beginning of the year.
Financial stocks had made the largest gains during the three-day rally, as the S&P 500's financial stock index jumped more than 7 percent over the three days ending on Wednesday. JPMorgan Chase retreated 96 cents, or 1.6 percent, to $57.81 and Bank of America fell 32 cents, or 2.5 percent, to $12.24.
IBM climbed after the company said it will buy Truven Health analytics for $2.6 billion, expanding the health care capabilities of its Watson computing system. IBM rose $6.35, or 5 percent, to $132.45, by far the largest gain in the Dow average.
Logistics company Ingram Micro surged $6.69, or 22.6 percent, to $36.34 after it agreed to be bought by Chinese shipping company Tianjin Tianhai. The deal values Ingram at about $6 billion, or $38.90 per share.
With the broader market slumping, investors returned again to the safe havens of telecom and utilities stocks. Those were the only S&P 500 sectors that traded higher, and they're also the only sectors that have made big gains in 2016.
European markets were mixed. Germany's DAX rose 0.9 percent and France's CAC 40 inched up 0.2 percent, but Britain's FTSE 100 slipped 1 percent. Asian stock markets rose. Japan's Nikkei 225 jumped 2.3 percent and South Korea's Kospi rose 1.3 percent. Hong Kong's Hang Seng surged 2.3 percent.
In metals trading, gold rose $14.90, or 1.2 percent, to $1,226.30 an ounce and silver added 5.5 cents to $15.432 an ounce. Copper inched down to $2.074 a pound.
The yield on the 10-year Treasury note fell to 1.74 percent from 1.82 percent. The euro fell to $1.1099 from $1.1139. The dollar slid to 113.58 yen from 113.77 yen.
In other energy trading, wholesale gasoline fell 3.1 cents to 97.2 cents a gallon. Heating oil declined 0.9 cents to $1.079 a gallon. Natural gas slipped 9 cents, or 4.6 percent, to $1.852 per 1,000 cubic feet.