The energy sector remains mired in depression, but one company has escaped unscathed.

Shares of U.S. refiner Valero Energy (VLO -1.01%) have actually managed to eke out a small gain over the past six months, during a time when most energy stocks are deep in the red. And just last week, the company reported better-then-expected quarterly earnings, sending shares soaring before the opening bell on Thursday. 

Why is the stock holding up so well? Can investors expect more profits to come? For clues, let's dig a little deeper into Valero's earnings and see what happened over the previous quarter.

What is Valero's secret to consistent profits?
Oil and gas producers are pretty straightforward. When energy prices fall, the value of their production goes down. That's why your savings at the gas pump have been a disaster for the oil patch. 

But refiners like Valero, HollyFrontier (HFC), and Phillips 66 (PSX -0.40%) are different. These companies live and die by the crack spread -- the price difference between a barrel of oil and refined products like gasoline and diesel. Because this spread has remained relatively stable, refiners are still cranking out consistent income. 

Last quarter, Valero posted a profit of $1.2 billion during the fourth quarter, down slightly from $1.3 billion last year. On a per-share basis, earnings came in at $2.22 a share, down from $2.38 a share a year earlier. However, excluding items such as tax benefits, earnings came in at $1.83 a share, actually up from $1.78 a share year over year.

The current strength in the refining sector provides a nice tailwind for the company. Low crude prices allow refiners to purchase their feedstock at a discount, enabling them to work in wider margins than they otherwise would earn. This is unlike energy explorers and producers, who depend on high crude oil prices to grow margins.

However, Valero's strategic position gives it a leg up over peers. The company has a bigger presence on the Gulf Coast than Phillips 66 or HollyFrontier, putting it closer to the Eagle Ford as well as other plays in Texas, Louisiana, and neighboring states. In addition, Valero can also process heavy crude blends from Canada and Mexico, which is even cheaper than the benchmark U.S. oil price. Those advantages showed up again in the company's quarterly results. 

Valero has also been ploughing a lot of capital back into its business and we're starting to see those investments pay off. Last quarter, throughput volumes averaged 2.8 million barrels per day, an increase of 41,000 barrels a day from a year earlier. That has allowed the company to take advantage of higher world-market costs for gasoline and other refined products. 

That all said, not everything is going Valero's way. Operating income from the company's ethanol segment plunged 49% year-over-year to $158 million. This was entirely due to lower gasoline and ethanol prices.

"Ethanol margins are likely to remain low in the $50 crude environment." Martin Parrish, Vice President of Alternative Fuels told analysts during the company's conference call. "We're in an advantaged location and we know we're not [the] marginal producer. So we expect to weather this time."

Two catalysts that could send Valero shares even higher
Of course, this is all backwards-looking. We're only concerned with where the stock is going next. That said, this report revealed a number of potential catalysts that could lift Valero shares in the near future.

First, Valero is looking to transfer more midstream properties to the company's master limited partnership Valero Energy Partners (NYSE: VLP). Midstream is industry lingo to describe all activities involved in the processing, storing, and transporting of energy products. In all, management is looking to move approximately $1 billion of midstream assets such as pipelines and processing facilities to the MLP in 2015, a figure that was much higher than expected.

This financial engineering could unlock a tremendous amount of value for shareholders. Because these assets tend to generate stable dividend income, investors are willing to pay a premium for pipeline and other midstream assets as stand-alone entities. Management estimates that they can sell these properties for about 10 times EBITDA, much higher than the assets are being valued inside Valero. 

In addition, executives also hinted that they are evaluating a share buyback program or further dividend hikes. Last week, executives made good on their promise to return more capital to investors, boosting the company's distribution 45% to $0.40 a share. Another payout increase would be a big vote of confidence in the company's future. 

The bottom line, Valero's refining business remains strong and there are a number of catalysts that could send shares even higher over the next six to twelve months. Despite the turmoil in the oil business, this company shows no signs of slowing down.