NEW YORK (AP) — Retail sales rose modestly in March, but higher prices for food, gasoline and other basics took a big share of consumers’ wallets.

Retail sales increased 0.5% after registering a revised 0.8% increase from January to February, reported the U.S. Commerce Department Thursday. Spending has been fueled by wage gains, solid hiring and more money in banking accounts. January’s increase of 4.9% was the biggest jump in spending since March 2021, when American households received a final federal stimulus check of $1,400. But soaring prices on everything, particularly at the gas pump, are making shoppers choosier about how they spend their money.

Excluding an 8.9% increase at gas stations, overall retail sales slipped 0.3% last month.

Overall, the retail sales picture was mixed, but shoppers still showed resilience in spending, economists said. Business at general merchandise stores was up 5.4%, while sales at clothing stores rose 2.6%. Restaurants had a 1% increase. But online sales dropped 6.4%, while auto sales were down 1.9% as auto companies faced a vehicle shortage. Major retailers will be issuing quarterly earnings reports next month, which will give a fuller picture of the state of the consumer.

“They are spending selectively this month, and the gasoline price spike from the Russian-Ukraine war was where most of the expenditures were made,” said Christopher S. Rupkey, chief economist at research firm FWDBONDS LLC.

But he added, “Inflation is not going away, but it will likely stop getting worse and that means less of a headwind for spending.”

Neil Saunders, managing director at GlobalData Retail, agreed that shoppers are nervous about inflation. He added that online purchases are taking a hit because he believes they’re more discretionary and easy to cut back. He also thinks the pullback online could be a consequence of shoppers assessing higher delivery charges.

The retail report covers only about a third of overall consumer spending and doesn’t include services such as haircuts, hotel stays and plane tickets, areas that have been rebounding from the depths of the pandemic.

Retailers are closely monitoring Russia’s war with Ukraine and how it could weigh on shoppers’ confidence but also worsen inflation. The conflict has already limited supplies of wheat, vegetable oils, and electronic components like chips. It’s pushed up fertilizer prices that were already high, made scarce supplies even harder to find and squeezed farmers, especially those in the developing world. In addition to the Russian invasion, rising COVID-19 cases and renewed restrictions in China could worsen supply chain issues.

The Labor Department said Tuesday that its consumer price index jumped 8.5% in March from 12 months earlier, the sharpest year-over-year increase since 1981. Prices have been pushed up by bottlenecked supply chains, robust consumer demand and disruptions to global food and energy markets worsened by the war. From February to March, inflation rose 1.2%, the biggest month-to-month jump since 2005. Gasoline prices drove more than half that increase.

According to AAA, the average price of a gallon of gasoline — $4.07 — is up 42% from a year ago, though it’s dipped in the past couple of weeks.

The March inflation numbers were the first to fully capture the surge in gasoline prices that followed Russia’s invasion of Ukraine on Feb. 24. Moscow’s attacks have triggered far-reaching Western sanctions against the Russian economy.

The acceleration of inflation is happening in an otherwise strong economy. In March, employers added a robust 431,000 jobs — the 11th straight month in which they’ve added at least 400,000. For 2021, they added 6.7 million jobs, the most in any year on record. In addition, job openings are near record highs, layoffs are at their lowest point since 1968 and the unemployment rate is just above a half-century low.

Matt Shay, CEO of National Retail Federation, the nation’s largest retail trade group, said that “consumers are adapting and shopping smarter for themselves and their families.” He believes the strength of the consumer can carry the economy through this economic uncertainty if policy makers implement measured policies and “don’t overreact to current conditions.”

NRF said the challenge for the Federal Reserve is to cool off demand without pushing the economy into a dramatic slowdown.

To protect themselves against any consumer spending downturn, retailers are cutting back on expenses, while taking a measured approach to ordering merchandise as well as adding surcharges.

Amazon announced on Wednesday that it will add a 5% “fuel and inflation surcharge ” to fees it charges third-party sellers who use the e-commerce giant’s fulfillment services. The Seattle-based company said on its website that the added fees, which take effect April 28, are “subject to change” and will apply to both apparel and non-apparel items.

Gary Friedman, CEO of upscale furniture chain RH, formerly known as Restoration Hardware, told analysts in late March that the company has seen consumer demand weakening in the company’s first quarter, which started in late January, that coincided with Russia’s war with Ukraine.

“I don’t think anybody really understands how high prices are going to go everywhere, in restaurants, in cars, in everything,” Friedman said. “If you’re going into a very difficult unpredictable time, you just got to be super flexible. You’ve got to be able to improvise, adapt, overcome, and kind of be ready for anything.”