Retail sales in July posted their biggest gain since March, tempering fears that the world's largest economy might be slipping back into recession.

Sales climbed 0.5 percent, in line with analyst forecasts and following an upwardly revised 0.3 percent gain in June, according to Commerce Department data released on Friday.

Consumer spending accounts for two thirds of U.S. economic activity, and the data indicates the third quarter was off to a decent start.

Excluding autos, sales increased 0.5 percent, well above forecasts for a 0.2 percent gain. The figures were bolstered by a 1.6 percent jump in gasoline station sales, in part reflecting the higher cost of fuel.

When you look at the overall data that's been coming out, it's really a mixed bag, and this shows that the economy is not falling off its wheels, said Rudy Narvas, senior economist at Societe Generale in New York.

Economic growth was anemic in the first half of the year and unemployment remained elevated, raising worries that the recovery might again falter and triggering speculation that the Federal Reserve might need to resort to additional monetary easing.

U.S. stock index futures added to gains after the retail sales data, while Treasury debt prices pared gains.

Retail sales excluding autos, gasoline and building materials rose 0.4 percent. Sporting goods stores and department stores fared the worst in an otherwise firm report, with sales dropping 1.5 percent and 0.8 percent, respectively.

One month's gain in retail spending was not sufficient to put to rest concerns that the U.S. economy lacks sufficient momentum to create new jobs, particularly with Washington set on cutting spending rather than doing more to stimulate investment and hiring.

Compounding uncertainty, financial markets have been see-sawing this week as investors alternate between seeking opportunity in battered shares prices and fretting that the market could be on the verge of a further dive.

Europe's worsening debt crisis, which has now gone well beyond the so-called periphery and is directly affecting France, has raised the cost of interbank borrowing in money markets, raising the specter of a return to the credit crunch of late 2008.

Global stock markets recovered ground on Friday after a rollercoaster week, but sentiment was still fragile. Investors would be looking to U.S. consumer sentiment figures for August released on Friday for clues into whether the retail spending gains that occurred in July will be sustained as the year progresses.

Economists note that late July and early August were a period of extreme turbulence for the United States as the country faced a political deadlock that pushed it to the brink of default and led to a historic downgrade by Standard & Poor's of the U.S. AAA credit rating.

(Additional reporting by Emily Flitter in New York; Editing by Andrea Ricci)