The nation's retailers are growing increasingly worried that as consumers pour more money into their gas tanks, they will devote less to filling up their shopping carts, with industry bellwether Wal-Mart Stores Inc. yesterday blaming higher prices at the pump for its weakest quarterly performance in four years.

So far, the relentless climb of oil and gas prices has pinched discount chains and dollar stores, which cater to lower-income shoppers. But if prices continue to rise, the pain could soon spread to chains that have long considered their customers immune to the fluctuating price of fuel, retail analysts said.

With oil and gas prices hovering in record territory, retailers are feeling yet another pressure: Their everyday cost of doing business is surging. A Barbie costs more to make. A diaper costs more to distribute. And a store costs more to cool and heat.

"It is a perilous time in retail," said Howard Davidowitz, chairman of Davidowitz & Associates Inc., a retail consulting and investment banking firm, who says a combination of escalating gas prices, heavy consumer debt and low savings "will affect every retailer in America."

Wal-Mart, shopped by nearly half the country's population every week, fingered mounting gas prices yesterday when it cut its prediction for third-quarter profit. Wal-Mart chief executive H. Lee Scott. Jr., said he feels "good about the economy, but I worry about rising oil prices." Those prices, he said, could "erase improvements" in the economy for the chain's lower- and middle-income customers.

Consumers, stung by escalating gas prices, say they are switching from name brands to generic ones, avoiding pricier chains in favor of cheaper competitors and abstaining from impulse purchases.

The national average for a gallon of regular unleaded gas hit $2.52 yesterday, according to the auto club AAA.

Shopping at Ross Dress for Less in Alexandria yesterday, Shirley Lee, a retiree from Mount Vernon, was tempted to buy a lunchbox and container of gumdrops for her granddaughter.

Then she thought about filling her gas tank -- a $40 task -- and took a pass on the gifts. "I'm trying to cut down," she said.

Or, as Janine Whitfield, a teacher from Tysons Corner, put it, "we are going to have to rethink how we spend money and how we drive."

With oil and gas prices hovering in record territory, retail executives said shoppers are shying away from many purchases, such as bedding and curtains, and focusing instead on basics, such as clothing and laundry detergent -- "needs versus wants," said Kiley F. Rawlins, a divisional vice president at Family Dollar Stores Inc., the nation's second-largest dollar-store chain.

The chain's customers, whose average household income is about $30,000 -- compared with $45,000 at Wal-Mart and $55,000 at Target -- are simply running out of money at the end of their paycheck cycle. Gas "is becoming a bigger portion of their overall spending, and the pie is not getting any bigger," Rawlins said.

Wachovia Securities estimates that a 30 percent increase in gas prices reduces discretionary spending by $243 for the average discount-chain shopper. Gas prices are up 36 percent this year, the firm found.

At J.C. Penney Co., where the customer base overlaps heavily with that of Wal-Mart, chief executive Myron E. Ullman III said he is "concerned about it. We've been surprised so far that it's been pretty much absorbed by the consumer," he added, "but we can't expect that to continue forever if it keeps going up."

Even companies that specialize in expensive electronics, such as Best Buy Co., are feeling the squeeze. The chain has blamed a lower customer count in its stores on shoppers who are worried about gas prices.

Tracy Mullin, president of the National Retail Federation, an industry trade group, called the rising fuel prices a "a double whammy for retailers. They are having to absorb the higher cost of gasoline in their everyday operations, and their consumers are spending more money to get to the stores."

Wal-Mart said higher fuel prices pushed its utility expenses up by $100 million and freight costs up by $30 million during the second quarter. J.C. Penney, meanwhile, blamed higher oil and gas prices for an additional $7 million to $10 million in costs over the past year.

Wal-Mart's second-quarter profit rose 5.8 percent, to $2.8 billion. Revenue rose 10.2 percent, to $76.8 billion. But its stock fell $1.53 to $47.57 after yesterday's report. J.C. Penney had a profit of $131 million during the quarter on revenue of $3.98 billion, up 5.4 percent. Its stock fell $2.16 to $49.74.

Most retailers are eating the costs of higher fuel rather than raising prices.

"We are investing in our customers to stay competitive," said Greg TenEyck, a spokesman for Safeway Inc., which said its transportation costs have surged.

That is scant relief for shoppers such as Franklin Crawford, who spends $45 gassing up his 2002 Ford Explorer. He saw a $39 mattress cover he liked at Bed, Bath & Beyond but opted instead for a $12 version he found at Wal-Mart.

He walked out of the Wal-Mart in Alexandria yesterday carrying a McDonald's Quarter Pounder and french fries, along with the mattress cover.

Crawford used to pay at least $8 to sit down and eat at his favorite buffets, but with gas prices escalating, he has downsized to McDonald's.