WASHINGTON (AP) — U.S. retail sales rose 0.9% in April, a solid increase that underscores Americans' ability to keep ramping up spending even as inflation persists at nearly a 40-year high.

The increase was driven by greater sales of cars, electronics, and at restaurants, the Commerce Department said Tuesday.

Even adjusting for inflation, which was 0.3% on a monthly basis in April, sales increased. Gas prices fell slightly last month, restraining inflation, after soaring in March in the aftermath of Russia's invasion of Ukraine.

Consumers are providing critical support to the economy even after a year of seeing prices spiral higher for gas, food, rent, and other necessities. The economy contracted in the first three months of the year, but consumer and business spending still increased at a healthy pace.

“Never bet against the U.S. consumer has always been a good adage,” said Paul Ashworth, chief U.S. economist at Capital Economics, a consulting firm, in a note to clients. “Despite the surge in prices weighing on their purchasing power, the U.S. consumer now appears to be single-handedly keeping the global economy afloat.”

The Tuesday report also showed that sales in March were revised much higher, to a gain of 1.4%, from 0.7%. As a result, spending even rose that month after adjusting for inflation, which surged to 1.2% as gas prices rose. The revision suggests the economy likely shrank by less than the 1.4% contraction that was reported last month.

The strength of the consumer makes a recession much less likely, at least anytime soon, Ashworth said. But it also keeps the pressure on the Federal Reserve to tighten borrowing costs in order to cool the economy.

Strong hiring, rapid wage increases, and a healthy level of savings — on average — have bolstered consumers' financial health, despite a sharp increase in consumer prices of 8.3% in April compared with a year ago. The increase was just below a four-decade high reached in March.

Still, economists are watching closely to see if consumer spending can continue to outpace inflation. Slower spending would drag down the economy's growth. While that might bring down inflation, it would also threaten to push the economy into recession.

Inflation is still disrupting many retailers' businesses, even if sales increase. On Tuesday, Walmart reported an unexpected drop in profit in the first quarter, even as it sales rose. Company executives said rising costs for fuel, food and labor boosted its expenses.

And for lower-income Americans, inflation is taking a harder toll and forcing many people to adjust their spending patterns. Walmart executives told analysts on a conference call on Tuesday that some customers were switching to cheaper store brands from national brands, particularly in lunch meats, as they juggled higher costs.

More customers are buying half-gallon jugs of milk, instead of a full gallon, company executives said. Milk prices have leapt 15% in the past year, according to government data.

Separately, Home Depot reported higher sales in its first quarter and raised its profit forecast for this year. Yet much of that increase simply reflected inflation — customer transactions fell 3.9%.

Home Depot's sales jumped in the pandemic as more people, cooped up at home, undertook home renovation projects, so some pullback was expected as pandemic restrictions fade.

Still, the robust sales figures in the government's report are also impressive since retail sales covers only about one-third of consumer spending, with the rest going to services such as travel, haircuts, and health care. Airlines and hotels are also reporting strong sales as more people are taking trips after postponing travel for two years.

The retail sales figures suggest that some supply chain snarls may be easing. Sales at auto dealers rose 2.2%, and they increased 1% at electronics stores and 0.7% at furniture stores.

Purchases at online retailers jumped 2.1% and they climbed 2% at restaurants and bars.

The ongoing strength of consumer demand, fueled by a robust labor market, is a key reason the Federal Reserve has accelerated its efforts to tighten credit and cool the economy. By doing so, Fed Chair Jerome Powell hopes to bring down inflation without causing a recession.

The Fed lifted the short-term benchmark interest rate it controls by a half-point at a policy meeting earlier this month, double its usual increase. Powell has also signaled the Fed will likely undertake the fastest pace of interest rate increases in 33 years to bring inflation to heel.

Several factors are enabling consumers to keep spending even as prices soar. Wages and salaries have been rising rapidly as businesses, struggling to fill a record-high number of open jobs, have been forced to offer more generous paychecks.

Average hourly earnings, excluding managers, rose 6.4% in April from a year earlier, one of the fastest annual increases in four decades. While that is below the rate of inflation, in some industries workers' inflation-adjusted wages are rising.

In April, hourly pay for workers in restaurants, bars, hotels and entertainment industries -- excluding managers -- jumped 11% from a year earlier. That's above the 8.3% rate of inflation that month.

Strong hiring also boosts spending simply by increasing the number of people earning paychecks. Employers have created 2 million jobs this year as the unemployment rate has fallen to 3.6%, near a half-century low.

And overall, consumers have more cash on hand. Last year’s stimulus checks pumped up many Americans’ bank accounts, including lower-income Americans. People also spent less in 2021 on travel, entertainment, and eating out. As a result, economists calculate that U.S. consumers have about $2 trillion more in savings than they otherwise would have based on pre-pandemic trends.

___

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

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