Valero Energy (VLO) said Tuesday its third-quarter profit fell 54%, as weaker refining margins and higher costs overshadowed revenue growth.

The world’s largest independent oil refiner did beat Wall Street expectations, reporting net income of $312 million, or 57 cents a share, compared to a year-ago profit of $674 million, or $1.21 a share. Analysts projected earnings of 41 cents a share.

Per-share earnings in the comparable period were $1.90 excluding severance expenses and a non-cash asset impairment loss.

Revenue grew 4.1% to $36.14 billion, also well ahead of expectations. Analysts were looking for $29.76 billion.

CEO Bill Klesse said refining margins in the latest period were “challenged, but out story remains intact.” Overall throughput margin per barrel was nearly cut in half to $7.76 from $13.12, while refining throughput volumes increased 6.5% to 2.77 million barrels a day.

Valero said lower gasoline and diesel margins contributed to the decline, in addition to lower light sweet and sour crude oil discounts.

The company added that higher costs related to complying with the U.S. federal renewable fuel standard put pressure on operating income.

Klesse said gasoline margins began the fourth quarter seasonally weak, but distillate margins continue to be strong.

Last month, San Antonio-based Valero filed for an initial public offering of its master limited partnership, Valero Energy Partners. Its assets initially include pipelines and terminal systems that support two Valero refineries, one in Texas and another in Tennessee.

Follow Matthew Rocco on Twitter @MatthewRocco