Geography just got a lot more important for investors in the booming refinery space.

Depending on their location, refineries could either benefit or suffer as a result of the sudden shutdown of BP's ( BP - Get Report) giant oil field in Alaska. Harry Chernoff, a principal at Pathfinder Capital Advisors, offers a simple formula for separating the winners from the losers.

Alaska stands out as a key supplier of fuel to the Western U.S., where demand can push margins incredibly high. Thus, if refiners can supply Western U.S. markets without using Alaskan crude -- and pocket strong California prices in the process -- they will benefit. Chernoff places Western Refining ( WNR) at the top of this fortunate group.

In contrast, if refiners depend heavily on Alaska's shut-down Prudhoe Bay for oil, they face supply and logistics problems that could hurt their results more than high California prices help them. Chernoff views Tesoro ( TSO) as vulnerable.

Chernoff puts Valero ( VLO - Get Report), a "super-independent" refiner that's much larger than its peers, into a final category. Because Valero is so diverse, he says, the company can capitalize on regional disruptions caused by the shutdown in Alaska -- where it obtains some of its fuel -- and still come out ahead.

"The clear winner is Western," Chernoff says. "Valero benefits, though not as much, because the company is so flexible. It can rearrange its system to the extent that it needs to very efficiently."

Chernoff owns Western and Valero, but has no position in Tesoro.

All three stocks currently trade at or near their all-time highs.

Go West

Western, which went public in January, is a newcomer to the group.

The company operates a single refinery in El Paso, Texas, where it processes fuel for five major markets in the Southwestern U.S. It supplies states near California, such as Arizona and New Mexico, so it enjoys high margins that are based on California prices.

"Any company with pricing tied to California that's not losing any crude supply will benefit," Chernoff stresses. "So Western really stands out on the positive side."

Impressed by the company's strong margins -- and opportunities for further expansion ahead -- Merrill Lynch analyst Christopher Moore on Wednesday reiterated his buy rating on Western and raised his price target on the stock to $31 a share. His firm has provided investment banking services to Western in the past and hopes to do so again.

Meanwhile, Banc of America analyst Philippe Lanier upgraded Western from neutral to buy even before the big Alaskan shutdown started threatening supplies on the West Coast. At the time, Western's stock had fallen 24% in a single quarter -- sinking below $16.50 in early June -- on concerns about weakening oil prices. But Lanier felt certain that the stock would come back.

He cited Western's improving profitability and his confidence in strong industry trends when issuing his upgrade. He also highlighted the company's Western U.S. operations in particular.

"Western Refining should grow earnings over the next three years due to realized production growth, increased sales into the higher-margin Phoenix market and increased processing of cheaper sour crude," Lanier wrote in June. In the meantime, "quarter-to-date margins have continued to exceed expectations due to refiners' continued difficulties to meet U.S. demand -- particularly in the West Coast, which Western has 30% margin exposure to."

Western's stock, up 3% to $26.90 on Wednesday, has since rocketed past Lanier's own $21 price target. Lanier included a discount in that target because of the company's single-refinery status. At the same time, however, he suggested that the company operates that refinery in an ideal place.

Notably, Western could capitalize not only on the shutdown in Alaska but also on possible hurricane-related disruptions in the Gulf Coast.

"Western's location in El Paso positions it between the Gulf and West coasts and allows it to benefit from margin expansion in both regions without weather risk," Lanier noted back in early June. So "Western Refining is one of our preferred investments through hurricane season."

Brewing Storm

By the time hurricane season hits full swing, the Prudhoe Bay shutdown could be taking a heavy toll on operations halfway across the country.

Right now, Tesoro -- which relies on Prudhoe Bay for 10% of its oil -- still sounds rather calm. The company announced on Monday that it has secured enough crude to supply its two West Coast refineries for the next 30 to 45 days. Thus, the company has suggested that it faces no near-term problems at least.

But Chernoff doubts that Tesoro can escape without some pain in the end.

"This production is probably going to remain offline for months, not weeks," he says. "I think what has happened is that the oil industry -- and certainly the government -- has tried to downplay the significance of this. They've said we'll just rebalance the system and work through it. But I think that most of that is just wishful thinking."

For starters, Chernoff says, fixing a 22-mile pipeline in Alaska takes some time. BP this week closed down the entire field after inspecting less than half of the pipeline there and discovering "unexpectedly severe corrosion" that had already caused one spill. Before the shutdown, Prudhoe Bay generated about 8% of the nation's domestically produced oil -- sending most of that to the West Coast.

With that production halted, Chernoff says, West Coast refiners have been forced to scramble for other supplies. They have no huge surplus of excess oil they can simply use up while they're waiting for repairs, he adds.

The government can't necessarily bail those companies out, either.

True, Chernoff acknowledges, the government has promised to release some oil from the Strategic Petroleum Reserve to help offset any shortfalls. However, he says, that reserve has no pipelines connecting to the California market -- and shifting oil from another region, like the Gulf Coast, still presents challenges.

Moreover, Chernoff stresses, refineries can't automatically settle for any oil that comes their way.

"If your refinery is designed for Prudhoe Bay oil, then you have a narrow range of oils you can use that can be easily and immediately substituted," Chernoff says. "I don't think this is a big national issue. But I think it's a big regional issue -- and it's going to be a big deal for some of these companies."

Flexible Giant

For Valero, the situation could bring more opportunities than setbacks.

The giant company operates 18 refineries that stretch across three different countries. It has invested heavily in systems that can process even the roughest of crudes, which has enhanced both its flexibility and its operating margins. Indeed, the company was on quite a roll -- with the momentum to beat Wall Street expectations once again -- even before the shutdown in Alaska.

"The delta (in second-quarter results) versus our estimates comes from a stronger realized margin on the West Coast and a slightly stronger margin in the Northeast," Credit Suisse analyst Mark Flannery wrote last week, following the company's latest quarterly update. Moreover, "Valero said that it expects the high refining margins are likely to persist for a while, and that the 'unprecedented start' to the third quarter means that 3Q06 earnings are expected to be better than 2Q06 and better than the current analysts' consensus estimate."

Flannery has an outperform rating and a $75 price target on Valero's stock. His firm counts the company among its investment banking clients.

JP Morgan analyst Jennifer Rowland has an outperform rating on Valero as well. She ranks Valero as the best investment in the independent refinery space because of the company's massive size, scale and flexibility. Her firm provides investment banking services to the company.

A giant oil conglomerate, ConocoPhillips ( COP - Get Report), might need to exercise some flexibility as well. While BP officially operates the Prudhoe Bay oil field, it shares ownership of the field with several other players. Indeed, ConocoPhillips actually owns more of the field than BP does -- and generates more of its oil there, too.

Yet BP, its reputation sullied by a string of high-profile embarrassments, seems to scare some experts the most.

"As you know, I am loath to make big changes in portfolios," Bob Howard, author of the Positive Patterns investment newsletter, wrote in a recent email to his clients. "But this business is about risk. ... After spending a wonderfully sleepless night thinking this thing over, I am changing my mind and suggesting you sell this one."