FILE - In this Aug. 25, 2019, file photo, a long line of unsold Clubman sports-utility vehicles sit at a Mini dealership in Highlands Ranch, Colo. On Friday, Sept. 13, the Commerce Department releases U.S. retail sales data for August. (David Zalubowski, File/Associated Press)

WASHINGTON — U.S. retail sales rose moderately in August, driven higher by a jump in auto buying and healthy online sales, evidence that consumers are still spending enough to support growth.

The Commerce Department said Friday that retail sales increased 0.4% last month, down from a strong 0.8% in July.

There were also signs that consumers have become more cautious. Excluding autos, sales were unchanged for the first time since February.

The data follows signs that consumer confidence, while still strong, has slipped a bit as the U.S.-China trade war has intensified. U.S. businesses have cut back on their investment and expansion plans amid the trade war’s uncertainty and exports have declined. That has left consumers as a key source of growth.

The economy is still creating jobs, though at a slower pace than last year, and wages are rising at a decent rate. That should continue to underpin Americans’ ability to spend.

Retail sales have been strong for most of this year, and most economists have expected sales to slow from that healthy pace.

Ian Shepherdson, chief economist at Pantheon Macroeconomics, said that consumer spending will likely be healthy through the July-September quarter, but then weaken in the final three months of the year.

“For now, the consumer looks strong, but the outlook is deteriorating as confidence falters in the face of the tariffs and, over the next few months, slowing job gains,” Shepherdson said.

Sales at restaurants and bars, an indicator of Americans’ discretionary spending, fell 1.2%, the steepest drop in nearly a year. Sales at grocery stores, clothing shops, and furniture stores also fell. General merchandise stores, which include chain retailers such as Walmart and Target, reported a 0.3% drop.

Online sales continued to soar, rising 1.6%, roughly the same amount as in July, when Amazon held its Prime Day.

Home and garden centers reported a strong 1.4% gain, which may have been partly spurred by preparations for Hurricane Dorian. Sales at sporting goods and health care stores also rose.

Retail sales make up about one-third of consumer spending, with the rest consisting of services such as haircuts and medical care. Consumer spending, in turn, accounts for about 70% of economic activity.

Consumers are still mostly optimistic about the economy. But the University of Michigan’s consumer sentiment index fell by the most in seven years in August as more Americans worry about the impact of tariffs.

The retail sales report comes as the divide between retail winners and losers is widening.

Big box stores like Target and Walmart and off-price retailers have been responding faster to shoppers’ increasing shift online by offering better bargains and convenient services like same-day deliveries. But many mall-based clothing chains and department stores continue to suffer weak sales as they struggle to lure in shoppers. Many have been straddled with excessive debt and been hurt by overexpansion.

Given this environment, the pace of retail bankruptcies and store closures in the U.S. picked up in the first half of the year, according to a report Wednesday from professional services firm BDO USA LLP. Fourteen retailers filed for bankruptcy during the first half of the year, including some like Shopko and Charlotte Russe that have liquidated.

So far this year, publicly traded U.S. retailers have announced they will close 8,558 stores and open 3,446, according to global research firm Coresight Research. That compares with 5,844 closures and 3,258 openings in all of 2018. Coresight estimates the store closures could number 12,000 by year-end.

Still, when looking at both private and public companies, for each company closing stores, 5.2 are opening locations, according to IHL Group, a global research firm.

___

AP Business Writer Anne D’Innocenzio contributed to this report from New York.

Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.