U.S retail sales rose in July for the first time in four months as demand rose broadly for everything from cars to electronics, a sign that consumers could drive faster economic growth in the third quarter.

Retail sales rose 0.8% last month, the Commerce Department said on Tuesday.

It was the biggest gain since February and well above analysts' expectations. Economists polled by Reuters had expected retail sales to rise 0.3%.

The report bolsters the view that the slowdown in economic growth during the second quarter will prove temporary.

It also offers some relief for President Barack Obama, whose November re-election bid has been imperiled by a weak jobs market. Republican challenger Mitt Romney is focusing his campaign on the weak economy that has plagued Obama's presidency.

The report could also splash a bit of water on hopes the Federal Reserve could soon launch another bond-buying program to help the economy.

Job creation in the United States slowed dramatically in the second quarter as consumer spending cooled and economic growth slowed. Job creation accelerated in July although the unemployment rate still rose to 8.3%.

Pointing to a strong increase in consumer spending during July, the so-called core measure of retail sales - which excludes autos, gasoline and building materials - rose 0.9%. That was the biggest gain since January.

Sales of motor vehicles and parts rose 0.8% last month. Receipts at electronics and appliance stores increased 0.9%. Sales of building materials gained 1.0%, while receipts as gasoline stations advanced 0.5%. 

Excluding autos, sales climbed 0.8%.