San Antonio-based Valero Energy (NYSE: VLO), North America's largest independent refiner and marketer of petroleum products, turned a $113 million net loss in its fiscal first quarter last year into a $98 million net profit this year. That's pretty darn impressive. And this is despite an after-tax loss of $352 million on derivative contracts that were closed and realized in the first quarter this year.

Here's the story
Demand for fuel, especially from outside the U.S. and Europe, has played a huge part in the strong show for the company, and I have no reason to believe why this trend should end soon. Looking forward, I believe this is the start of a pretty bullish trend for Valero as demand for fuel is unlikely to drop, especially with emerging countries experiencing domestic demand spikes of their own. Quite independently, demand for jet fuel is on the rise, and companies like Valero will only see a substantial increase in revenues in the near future.

Where's the beef?
Looking at the numbers a bit closer, we can see that income from operations in the refining segment was $276 million this quarter compared with a loss of $15 million a year ago. Its core business has flourished thanks to some astute decisions by management. Last year, it got rid off its Delaware and Paulsboro refineries that did not fit well in its scheme of things.

These are the types of larger managerial decisions that make me want to take a look into Valero's operational efficiency. Total throughput volumes increased by approximately 8.6% from last year, which shows that the company is rallying. Foolish investors must take note of this positive development. Also, the $1.7 billion acquisition of Chevron's (NYSE: CVX) Pembroke refinery in the U.K. will yield results soon. Valero has the right set of ingredients to flourish in the long run.

A threat
However, the overall macroeconomic situation in the U.S. -- with gasoline prices threatening to cross $4 -- things may not look rosy for Valero in the immediate future. In fact, the company's operating income in its retail segment saw a slight drop this quarter to $66 million compared with $71 million last year. Companies, like Frontier Oil (NYSE: FTO) and Holly Corp. (NYSE: HOC), that operate in the retail segment will face the heat. This, undoubtedly, will offset the gains from the refining segment in the fiscal second quarter to a small extent.

A Foolish belief
However, I remain bullish, keeping the overall picture in mind. Foolish investors will see merit in this stock that I believe is currently undervalued, given the huge demand this company caters to.