Refining giant Valero Energy (NYSE:VLO)has released its fourth-quarter earnings. It was a busy quarter that delivered adjusted earnings of $1.78 per share, which was at the high end of Valero's guidance. Those earnings were well in excess of the $1.47 that analysts expected.

Valero's ethanol segment fueled core earnings. The segment produced $269 million in operating income on the quarter, which was well above the $12 million it earned in the fourth quarter of 2012. A decrease in corn prices, low industry ethanol inventories, and record production volumes combined to produce significantly higher margins for the company. Overall, Valero delivered record ethanol production of 3.6 million gallons per day.

Refining margins, on the other hand, were weaker for Valero on the quarter when compared to the previous year. However, the company was able to take advantage of favorable crude oil discounts at most of its locations. Without these discounts its margins would have been much weaker.

In addition to earnings from its core businesses, Valero also recorded a one-time gain of $0.60 per share relating to its spinoff of CST Brands (NYSE:CST). The company had retained a 20% stake in the convenience store business after spinning it off to shareholders in May. However, it completed the exit of its holdings in CST Brands in the quarter, which brought in $448 million in net proceeds and resulted in a gain of $325 million.

CEO Bill Klesse said in a press release that Valero "had a great fourth quarter and ended the year on a strong note." He went on to point out that the "ethanol business enjoyed high margins and set a record-high for quarterly and annual operating income."