NEW YORK -- Miners and other companies dealing in commodities helped pull the stock market out of a three-day slump on Thursday. News that China's trade rebounded last month signaled the end of a six-month slowdown for the world's biggest buyer of raw materials. The report drove prices up for copper and other commodities, and that helped lift Newmont Mining, Freeport-McMoRan and other stocks in the materials industry.
"The one thing that stands out today is the better news out of China," said David Joy, the chief market strategist at Ameriprise Financial. "It comes as a pleasant surprise."
The Standard & Poor's 500 index edged up 6.57 points, or 0.4 percent, to 1,697.48.
The Dow Jones industrial average rose 27.65 points, or 0.2 percent, to 15,498.32. The Nasdaq composite gained 15.12 points, or 0.4 percent, to 3,669.12.
With little other news to drive trading, the stock market had meandered lower this week. The S&P 500 index fell three days straight and remains down 0.7 for the week. It's still up 19 percent this year.
Brad McMillan, chief investment officer for Commonwealth Financial Network in Waltham, Mass., said a number of concerns have weighed on the market this week. Comments from Federal Reserve officials have convinced many investors that the bank will begin pulling back its support for the economy in the coming months.
In an interview on CNBC after the market closed, Richard Fisher, head of the Fed's Dallas branch, reaffirmed his view that it's time to wind down the bank's stimulus effort.
At the same time, companies are warning of slower sales and turning in tepid second-quarter results. McMillan said it's starting to look like corporate earnings haven't kept up with the stock market's strong pace this year.
"I think people are realizing that stock values are getting disconnected from earnings growth," McMillan said. "For the rally to continue, people will have to pay more for earnings that aren't growing that much."
Investors are paying more for profits. A year ago, the price-earnings ratio for the S&P 500 was 13.4, according to the data provider FactSet. Now it's 15.6, which is still near the long-run average.
Among companies reporting earnings, the maker of Oreo cookies, Mondelez International, turned in better results than Wall Street had expected late Wednesday. The company also announced plans to spend another $5 billion buying its own stock. Mondelez International gained $1.44, or 5 percent, to $32.70.
Tesla Motors jumped 14 percent following news that the maker of electric cars blew past Wall Street's profit forecasts for its most recent quarter. Revenue soared thanks to stronger sales of its Model S. Tesla gained $19.25 to $153.48.
In economic news, the government reported that the average number of people who applied for unemployment benefits over the past four weeks dropped 6,250 to 335,500. That's the lowest level since November 2007, a month before the Great Recession got underway.
Gradual but steady gains for the U.S. economy and corporate profits have lifted the stock market to record territory this year. The S&P 500 index closed at an all-time high of 1,709.67 on Friday.
In other Thursday trading, the better economic news out of China sent copper, widely used for electronics and to wire buildings, up 10 cents, or 3 percent, to $3.27 a pound. Gold rose $24.60, or 2 percent, to $1,309.90 an ounce.
The yield on the 10-year Treasury note fell to 2.58 percent from 2.60 percent late Wednesday.
Among other companies in the news:
-- Newmont Mining rose $2.30, or 9 percent, to $28.78 and Freeport-McMoRan Copper & Gold rose $1.37, or 5 percent, to $30.80. Mining companies rose broadly along with prices for commodities such as copper.
-- Groupon jumped $1.88, or 22 percent, to $10.60. The company named its co-founder Eric Lefkofsky as CEO late Wednesday and said it plans to buy $300 million of its own stock over the next two years.
-- J.C. Penney jumped 86 cents, or 7 percent, to $13.66 following a news report Thursday that the department store chain is starting a search to replace CEO Mike Ullman.