NEW YORK, NY - AUGUST 13: Traders work on the floor of the New York Stock Exchange (NYSE) on August 13, 2014 in New York City. Despite the continued global unrest, stocks finished with solid gains on Wednesday with the Dow up 91 points and entered positive territory for the year. (Photo by Spencer Platt/Getty Images) ORG XMIT: 507073505

Photo: Spencer Platt

NEW YORK, NY - AUGUST 13: Traders work on the floor of the 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.

More Information

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.

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.

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.