* Loss 48 cents/share; Street view loss 50 cents
* Shares down 4.4 percent
* Says Q3 loss a possibility, Q4 challenging (Corrects analyst name in paragraph 12)
By Anna Driver
HOUSTON, July 28 (Reuters) - Valero Energy Corp (VLO.N) reported a second-quarter loss on Tuesday as hefty fuel inventories and weak demand weighed down profit margins, a situation that has persisted and could cause a loss in the current quarter for the largest U.S. refining company.
Valero shares fell more than 4 percent on the New York Stock Exchange.
Government data last week showed inventories of distillates, including heating oil and diesel, at a 25-year high as the global recession bites into industrial consumption of fuel.
Valero's profit margins have been hurt as the lower-grade, or sour, crude oil it uses has lost much of the cost advantage over higher-grade crude.
"We did not anticipate such a dramatic fall in the medium and heavy sour discounts," Valero chief executive officer Bill Klesse said on a call with investors.
That situation is not likely to improve any time soon. Valero forecast its margins in the third quarter would be similar to those in the second quarter, which might result in another net loss. The fourth quarter would be challenging as well, the company told analysts.
Margins will bounce back when the global economy improves, the company said.
Valero, based in San Antonio, Texas, shut its Aruba refinery earlier this month due to weak market conditions. The company said the facility will remain closed at least until September, when the margin outlook will be reviewed.
Valero's loss was slightly narrower than Wall Street expected, but analysts said investors would focus on the weak outlook for refiners.
The second-quarter net loss was $254 million, or 48 cents per share, compared with a profit of $734 million, or $1.37 per share, a year earlier. Revenue fell by more than half, to $17.93 billion from $36.6 billion.
Analysts, on average, had expected a loss of 50 cents per share on revenue of $15.874 billion, according to Reuters Estimates.
"The quality of the earnings is a bit worse than expected as losses from (Valero's) refining operation (are) larger than expected, partially offset by a higher than expected tax benefit and retail contribution," Paul Cheng, an analyst at Barclays Capital, told clients in a research note.
"We believe investors will focus on the weakness of its refining operation as well as the current continuing weak market conditions."
The refiner told analysts it expects to spend $2 billion to $2.5 billion in 2010 and is on track to meet its 2009 spending target of $2.5 billion.
Valero, which operates 16 refineries in the United States, Canada and the Caribbean, processed 2.485 million barrels of crude oil and other feedstocks per day in the quarter, down 9 percent from a year ago.
Valero shares fell 77 cents, or 4 percent, to $18 afternoon trading on the New York stock exchange. That decline is in line with a drop in Standard & Poor's index of refining companies .GSPENRM. (Reporting by Anna Driver; additional reporting by Steve James in New York; editing by John Wallace and Andre Grenon)