NEW YORK -- A modest gain for the stock market on Wednesday tugged the Dow Jones industrial average back into the black for the year as investors set aside concerns about Ukraine, Iraq and earnings, at least for a day.
Amazon led the gains in light trading, despite a mixed batch of economic and corporate news. The gains were broad but thin. Three companies rose for every one that fell on the New York Stock Exchange, and all 10 sectors in the S&P 500 ended higher.
"This is a very resilient market," said Uri Landesman, president of Platinum Partners, a hedge fund in New York.
Markets have turned choppy in recent weeks as investors have weighed a host of concerns. At times, worries over global conflicts and Europe's economy have overshadowed signs of steady growth in the U.S. economy and rising corporate profits. Landesman pointed to plenty of reasons for traders to ditch stocks this summer, including high prices.
"We're getting through the summer and the market is still pretty close to its high," he said. "It shows you the trend is still upward."
Amazon, the online retail giant, unveiled a new payment system for mobile phones. The device, called Amazon Local Register, is aimed at helping small businesses accept payments through smartphones and tablets. Amazon's stock gained $6.96, or 2 percent, to $326.28.
The S&P 500 rose 12.97 points, or 0.7 percent, to end at 1,946.72. The Dow gained 91.26 points, or 0.6 percent, to 16,651.80, the first time in August that the 30-stock average has been in positive territory for the year.
The tech-heavy Nasdaq composite climbed 44.87 points, or 1 percent, to 4,434.13.
Of the handful of companies reporting quarterly results on Wednesday, a few well-known names warned of sliding sales and shrinking profits. Macy's turned in results that fell short of Wall Street's forecasts. The department store chain also cut its full-year outlook for sales, saying it couldn't make up from a shortfall at the start of the year when winter storms kept shoppers at home. The company's stock dropped $3.29, or 6 percent, to $56.47.
Deere & Co., the country's largest maker of farm equipment, said weak sales will likely cut into its earnings for the entire year. Deere dropped $1.99, or 2 percent, to $84.49.
King Digital Entertainment, maker of the "Candy Crush Saga" video game, plunged 23 percent. The company reported second-quarter sales that came up short of estimates and also cut its full-year earnings forecast. King's stock lost $4.21 to $13.99.
Despite some high-profile misses, however, overall corporate results for the second quarter have looked solid. With the earnings season drawing to a close, seven out of 10 companies in the S&P 500 have posted stronger profits than analysts projected, according to S&P Capital IQ. Quarterly earnings are on track to climb 10 percent over the year before. That's much better than the 3 percent increase companies reported for the first quarter of 2014.
The Commerce Department said Wednesday that retail sales edged up by a tiny amount compared with the prior month. A separate report said businesses continued adding to their stockpiles in June. A greater amount of goods on store shelves and in warehouses reflects optimism about future demand.
In other trading, Germany's DAX gained 1.4 percent, while France's CAC 40 rose 0.8 percent. Britain's FTSE 100 inched up 0.4 percent. All three indexes have slumped more than 1 percent this month.
In the U.S. government bond market, the yield on the 10-year Treasury note was 2.42 percent, just shy of its low for the year and a drop from 2.45 percent late Tuesday. U.S. crude oil rose 22 cents to $97.59 a barrel in New York.
Elsewhere, gold rose $3.90 to $1,314.50 an ounce, silver slipped 6 cents to $19.85 an ounce and copper fell four cents to $3.11 a pound.