* Marathon Petroleum, Western Refining and PBF Energy see margins shrink
* Western Refining says margins improving as it accesses low-cost crude
* Western Refining shares up 4 pct, Marathon Petroleum up 2 pct
By Swetha Gopinath
Aug 1 (Reuters) - Marathon Petroleum Corp and rival U.S. oil refiners are betting on new pipelines and higher volumes to win back margins lost to the price shocks that led many to record lower quarterly profits.
Marathon Petroleum's shares rose more than 2 percent in early trading and Western Refining Inc was up 4 percent, despite both reporting a decline in second-quarter margins due to the higher costs of crude and mandatory ethanol credits.
U.S. refiners are being hurt by the rising cost of ethanol credits, or Renewable Identification Numbers (RINs), which they are required to purchase in order to meet blending targets set by the U.S. Environmental Protection Agency.
Their margins have shrunk as discounts on U.S. crude relative to the more expensive European benchmark have narrowed, almost erasing a cost advantage that U.S. refiners had enjoyed for nearly three years.
Analysts, however, expect these crude spreads to widen again as extra pipeline capacity comes on stream to move Texas crude to the Gulf Coast. Higher U.S. oil output will also offset crude draws from the U.S. crude futures hub at Cushing, Oklahoma.
"On a short-term basis, refiners are going to see a profitability squeeze from the narrowing spread," said John Williams, investment analyst at T. Rowe Price. "But on a longer time horizon, they will be able to make a little bit of money."
A bright spot for Marathon Petroleum was an increase in refinery throughputs and sales volumes in the second quarter, driven by its acquisition of the Galveston Bay refinery in Texas from BP Plc.
This helped the company to report a better-than-expected adjusted profit of $1.95 per share. Analysts on average had forecast $1.93 per share, according to Thomson Reuters I/B/E/S.
But Marathon, the third-largest dedicated oil refiner in the United States, also said its refining and marketing gross margins almost halved to $6.18 per barrel in the second quarter.
U.S. refiners typically purchase low-cost U.S. crude and sell refined products, such as gasoline and diesel, at prices linked to the European benchmark, Brent.
But rising U.S. crude prices had narrowed the premium of North Sea Brent to U.S. benchmark West Texas Intermediate to $2.67 on Wednesday. The premium was about $20 for most of last year.
Further up the production chain, second-quarter results from the world's oil majors have seen output targets abandoned, profit targets missed and spending kept on a tight leash.
Thursday's slew of results saw Royal Dutch Shell and Exxon Mobil disappoint analysts.
Western Refining, also hit by weaker margins, reported a 37 percent drop in second-quarter net profit.
But Western said its future refining margins would be boosted by the launch of its Delaware Basin crude gathering system, a source of low-cost crude for its refinery in Texas.
Morningstar analyst Allen Good said the long-term outlook for the U.S. oil refining sector was positive.
"A lot of people realize that a lot of what we see now is transitory; that the RIN costs and the crude differentials will eventually abate," Good said.
The RIN credits have become costlier in recent months as refiners fear a shortfall next year, drawing the ire of refiners nationwide.
PBF Energy Inc, which also reported a lower second-quarter profit, said it expects to spend more than $200 million on RINs this year - making the credits one of its most expensive cost categories.
"It exceeds the salaries and wages we pay to operate all three of our refineries," PBF Executive Chairman Tom O'Malley said in a statement.
Coastal refiners such as PBF have taken to moving cheap Bakken crude by rail. PBF said it expected to reach its full capacity of rail-delivered crude by the end of 2014, and would also run more imported crude if it made economic sense.
PBF also said it would contribute logistic assets to a master limited partnership (MLP), joining other refiners - including Phillips 66 and Tesoro Corp - in creating MLPs to access capital markets and fund growth.
PBF's shares were at $22.68 on the New York Stock Exchange. Marathon Petroleum shares were at $75.10, while Western Refining was trading at $31.26.