FORTUNE -- An oil spike has a way of making market watchers nervous, and retail investors are no exception. After going on a tear in 2009 and 2010 -- the S&P 500 retail index rose 78% and 37%, respectively, more than doubling the performance of the broader index in both years -- retail stocks have begun to falter. Surging gas prices have cast a pall over the sector, which is up just 0.7% so far this year, while the S&P is up 3.4%.
That's not because the companies themselves have been doing badly. Sales at chain stores that have been open for at least a year rose 4.2% in February, according to the International Council of Shopping Centers (ICSC). Consumer confidence recently hit a three-year high, and the BEA reported that spending on goods last quarter surpassed 2008 levels.
But retail analysts have begun to sound warnings about the danger that high gas prices pose for the sector. In the same report that announced the rise in February sales, the ICSC added that the rising cost of crude was "the big worry" facing consumers and the economy.
"All told, with gasoline prices expected to be up almost 6% in 2011, there is likely to be some pullback in retail sales and consumer spending as a result," wrote J.P Morgan's Charles Grom in a recent note.
It's easy to see why rising gas prices have alarmed investors. When people pay more for fuel, they're less likely to drive to stores. Once they're there, they have less money to spend. Every $1 increase in the price of a gallon of gas lowers consumer spending by $100 billion, according to Deutsche Bank analyst Mike Baker. If gas prices were to stay at $3.47 through the rest of 2011, resulting in a yearlong average of $3.41 -- a $0.67 increase from 2010 -- consumer spending would decline by $67 billion.
Retail sales zig, oil zags
And yet, many of the same analysts that are bemoaning the coming gas spike have also noted that gas prices don't correlate very closely to retail sales. Baker, who wrote that higher fuel costs have reaffirmed his decision to downgrade the retail sector, ran a comparison of gas prices and retail sales over the last decade and found a mere -9% correlation (it's negative because rising gas prices cause sales to fall).
Grom, of J.P. Morgan, crunched the numbers and came up with a -21.9% correlation -- more significant, but much less so than the link between retail sales and employment growth (66.3%) or housing (46.6%).
Given the faint connection between retail sales and fuel costs, it seems strange that analysts are so spooked by soaring gas prices. But a closer look at the numbers shows that, while the average correlation is small, different retailers are impacted in wildly divergent ways.
As it turns out, retailers that make higher-end goods -- consumer electronics vendors, home centers, and office products stores -- actually outperformed when gas prices soared, according to Baker. That's not to say that rising fuel costs generate demand for iPods and lawnmowers, but rather that a boost in gas prices often coincides with economic flush times, when the middle class spends more on discretionary purchases. Some of the top performers in this group were Best Buy (BBY, Fortune 500), Staples (SPLS, Fortune 500), and Home Depot (HD, Fortune 500).
Meanwhile, the companies that were worst off when gas prices were high were value-oriented chains -- Family Dollar (FDO, Fortune 500), Dollar Tree (DLTR, Fortune 500), and 99 Cents Only (NDN). Because those companies' customers tend to be less well off, they spend a larger proportion of their overall budget on gas. As a result, when gas costs go up, their purchasing power goes down.
"The impact is far, far greater for value," says Joel Bines, a managing director in the retail practice of AlixPartners. "You see fewer trips and less purchasing on those trips. For the upper-middle and luxury customer, the impact is muted."
So far during the current oil spike, however, investors don't seem as worried about the retailers at greater risk. Shares of the aforementioned discount chains have all risen since oil prices started spiking in late February, outperforming the overall sector. It may be that investors haven't apprehended the connection -- or, alternately, that they're looking further out. And shares of both Family Dollar and 99 Cents Only have been boosted by buyout offers.
Whatever the case, while discounters may suffer in the short term from rising gas prices, Baker says, they ultimately benefit if fuel stays expensive for several months. In the end, $4 gas sends everyone running to the dollar store.