Retail sales rose in February as shoppers increased their spending before gasoline prices spiked in the wake of the attacks on Iran, according to data released by the U.S. Commerce Department. The department said retail sales increased 0.6% last month, after a revised 0.1% decline in January, a result that retailers and economists said suggested a continued baseline of moderate expansion but not a guarantee for the weeks after the conflict began.

The retail report also underscored how quickly energy costs can feed into household budgets. After the Iran war began Feb. 28 and shut down the Strait of Hormuz, cutting off one-fifth of the world’s oil supply, gasoline prices accelerated sharply and contributed to renewed concerns about inflation and consumer behavior.

GlobalData managing director Neil Saunders said the February numbers did not reflect problems that developed once the Iran conflict started. “While the overall numbers are good and suggest a continued trajectory of reasonable expansion for retail, they do not reflect the problems that have arisen since the start of the Iran conflict,” Saunders wrote. “Since the start of March our own numbers show that consumer sentiment has soured and that rising gas prices are starting to spook consumers.”

Ahead of the war, the report showed strength in car-related spending and other categories. The Commerce Department said sales at motor vehicle and auto parts dealerships rose 1.2% in February. Excluding that sector, retail sales climbed 0.4%, while clothing and accessories stores rose 2%, electronics and appliance stores rose 0.5%, and online retailers rose 0.7%. Health and personal care stores rose 2.3%, and the lone services category tracked in the snapshot—restaurants—registered a 0.4% increase.

Economist Ksenia Bushmeneva of TD Bank Group said in a report published Wednesday that the data was solid. She wrote, “This was a solid report,” adding that higher gas prices at the pump would likely lift overall sales in March because the government retail sales figures are not adjusted for inflation, even as real spending could weaken as people offset fuel costs by trimming other purchases.

Bushmeneva said real spending might take a hit as consumers try to reduce discretionary outlays, with travel and recreation “the most likely areas to be cut.” Gas prices were already rising in late March and early April, including as the average price for a gallon of regular gasoline exceeded $4—marking the first time it had done so since 2022—before reaching $4.06, according to AAA.

Analysts also pointed to what rising fuel bills mean across household income levels. Chief economist Samuel Tombs at Pantheon Economics wrote that the hit to real incomes from higher gas prices is “especially regressive,” hurting lower-income households disproportionately, while the lift from tax refunds is spread more evenly. Tombs said refunds also “will slow to a trickle by late April,” leaving less protection if high prices persist.

Patrick De Haan, an analyst at GasBuddy that tracks fuel prices, said a key gauge is how much gas expenditures account for shoppers’ income. He said gas prices were approaching 3% of household medium income and “When that gets up to about 4, 4 1/2, 5%, that’s really when people really start trimming back on some of their discretionary purchases.”

Some retailers have already warned investors that the war’s impact on energy costs could change consumer demand. Daniel Erver, CEO of Hennes & Mauritz, said last week the Swedish fast fashion chain expects energy prices to have a “significant impact on the consumer behavior” if the war is prolonged. Darren Rebelez, CEO of convenience store chain Casey’s General Stores, told investors last month that a significant pullback in customer spending is unlikely unless gas approaches $5 per gallon.