NEW YORK — Americans increased their purchases at retailers last month – for clothing, dining out, online goods and other areas – in a sign that solid consumer spending is still powering a resilient U.S. economy.

Retail sales rose a better-than-expected 0.7% in July from June, according to the Commerce Department’s report Tuesday. The gain was higher than a revised 0.3% increase the previous month and marked four straight months of increases. The figure also surpassed the 0.2% increase in consumer prices last month, indicating that shoppers are spending at a healthy pace.

Analysts noted that spending on Amazon Prime Day, the online juggernaut’s big two-day sales event that took place earlier last month, also helped boost online sales.

Excluding autos and gas, sales rose a solid 1%. A closely watched category of retail sales that excludes auto dealers, gas stations and building materials and feeds into the gross domestic product jumped 1% last month compared to the prior month, the biggest move in six months, analysts said.

“Maybe it’s a one-off, but Americans put aside their penny-pinching ways and spent big on food and fun in July,” said Robert Frick, corporate economist with Navy Federal Credit Union, in a note published Tuesday.

Department stores posted a 0.9% increase, while clothing and accessories stores had a 1% gain. Sales at sporting goods stores and hobby stores rose 1.5%. At restaurants, sales rose 1.4%, while online sales increased 1.9%.

But higher interest rates are weighing on economic activities that are highly dependent on credit, like sales of homes, vehicles, furniture and electronics, according to Bill Adams, chief economist for Comerica Bank in Dallas. Furniture and home furnishings stores and electronics stores remained weak, registering declines. And sales at motor vehicle and parts dealers also were down from the prior month.

Still, the uptick reflects the economy’s resiliency despite a still challenging economic environment of still high prices and higher interest rates that make borrowing on credit cards and getting a mortgage for a home more expensive. Yet spending has been volatile this year after surging nearly 3% in January. Sales tumbled in February and March before recovering in April and May.

The report comes as inflation has cooled but not enough to meet the Federal Reserve’s target rate.

Inflation in the United States edged up in July after 12 straight months of declines. But excluding volatile food and energy costs, so-called core inflation matched the smallest monthly rise in nearly two years. That’s a sign that the Federal Reserve’s interest rate hikes have continued to slow price increases.

The inflation data the government reported last week showed that overall consumer prices rose 3.2% from a year earlier. The latest figure remained far below last year’s peak of 9.1%, though still above the Fed’s 2% inflation target.

Overall prices, measured on a month-to-month basis rose 0.2% in July; roughly 90% of it reflected higher housing costs. Excluding shelter, Paul Ashworth of Capital Economics calculated that core prices actually fell 0.1% from June to July.

A slew of earnings results from big companies like Walmart, Target and Macy’s this week and next should offer some more clues on shoppers’ mindset and how they will manage inflation and higher interest rates in the latter half of the year including the critical holiday season.

Moreover, a student loan moratorium – which allowed Americans to divert money that used to go to loan payments to dinners out and new furniture – ends later this year.

Home Depot, the nation’s largest home improvement retailer, reported on Tuesday second-quarter results that topped profit and sales expectations, but sales continued to decline as inflation and soaring interest rates playing a larger role in the spending choices by Americans.

Despite the stronger-than-expected sales figures, Home Depot stuck to previous guidance for the year, seeing sales decline between 2% and 5%, after lowering its forecast in the last quarter.

At least one retailer is already kicking off holiday sales earlier than last year to get shoppers to spend.

Lowe’s, the nation’s second-largest home improvement retailer, started offering some holiday merchandise like wreaths and other home decor online last month, roughly two months earlier than a year ago as it saw shoppers began search online for holiday items this summer, according to Bill Boltz, Lowe’s executive vice president of merchandising.

The government’s monthly retail sales report offers only a partial look at consumer spending; it doesn’t include many services, including health care, travel and hotel lodging.

________

AP Economics Writer Paul Wiseman in Washington and AP Business Writer Michelle Chapman in New York contributed to this report.

___

Follow Anne D’Innocenzio: http://twitter.com/ADInnocenzio