UPDATE 1-Refiner Valero posts higher-than-expected quarterly profit

(Adds details)

July 27 (Reuters) - Refiner Valero Energy Corp's quarterly profit topped estimates as it operated at a higher capacity, offsetting a rise in costs and lower margins in its ethanol unit.

San Antonio, Texas-based Valero's refineries operated at 96 percent throughput capacity utilization in the second quarter, up from 94 percent a year ago.

However, Valero on Thursday said expenses rose 16.5 percent to $21.38 billion in the quarter ended June 30.

Income from Valero's ethanol segment more than halved to $31 million compared with $69 million a year earlier.

Biofuel blending costs rose to $255 million from $173 million, mainly due to higher Renewable Identification Number (RIN) expenses, the company said.

Net income attributable to Valero shareholders fell to $548 million, or $1.23 per share, in the quarter, from $814 million, or $1.73 per share, a year earlier.

The company's earnings handily beat analysts' expectations by 13 cents, as per Thomson Reuters I/B/E/S.

Operating revenue rose to $22.25 billion from $19.58 billion.

(Reporting by Ahmed Farhatha in Bengaluru; Editing by Martina D'Couto)