Retail sales rose more than analysts expected last month, as shoppers headed to stores and online to drive gains in electronics and clothing, government data showed.

Total sales rose 0.7% month-on-month to $523.5 billion, better than the consensus on Econoday for an increase of 0.3%. The previous month’s print was revised to 0.3% growth from 0.4% previously, the US Census Bureau said on Thursday.

Year-on-year, retail sales are up 3.4%. In the month, sales excluding vehicles and parts rose 1%, faster than the 0.3% price in June and ahead of the consensus for 0.4%. Stripping out autos and gasoline stations, sales rose 0.9% from 0.6% in June and better than the 0.5% expected.

Receive News & Ratings Via Email - Enter your email address below to receive a concise daily summary of the latest news and analysts' ratings with MarketBeat.com's FREE daily email newsletter.

“Consumers were out in droves, apparently, enjoying the heat and spending on things like electronics/appliances, clothing, dining out (the most discretionary of them all), and hitting the department stores, and going online,” said Jennifer Lee, a senior economist with BMO Capital Markets Economics.

Sales at electronics and appliance stores rose 0.9% and were up 0.8% at clothing and accessories retailers. Nonstore retailers, which includes e-commerce, reported a 2.8% gain in the month while food services and drinking places sales increased 1.1%, the data showed.