Energy is the key to our modern lives. Everything about today's society is tied to accessing cheap, reliable sources of fuel for transportation and electricity. If you're looking for the best stocks to buy, this very large, very diverse sector is worth paying attention to. Furthermore, the world's middle class is projected to increase by about 1 billion people during the next couple of decades. In short, demand for cheap, reliable energy is only going to increase going forward.

Let's take a look at three companies helping the world meet that demand. Are these three of the best stocks to buy? 

A pure-play competing against juggernauts 
Vestas Wind Systems ADR 
(OTC:VWDRY) specializes in wind turbines, competing against the likes of General Electric Company (NYSE: GE) and Siemens AG (NASDAQOTH: SIEGY), two of the worlds largest industrial conglomerates and major players in industrial power generation. In short, pretty much every electric utility in the world does business with GE or Siemens, if not both. 

Why would I put forth a company that competes against two dominant foes? In short, when it's a well-run, well-established company on the right side of the demand cycle, it's worth a closer look. 

Just a few years ago, Vestas was in pretty bad shape. The wind turbine business is very cyclical, and Vestas' fixed costs were killing the company in slower years:

VWDRY Net Income (TTM) Chart

VWDRY Net Income (TTM) data by YCharts.

The "lumpiness" was a major problem, because it meant that, in the lean times, the company wasn't able to leverage its assets effectively. During the past couple of years, management has worked hard to change that, selling off significant parts of its in-house manufacturing capacity to companies that can better leverage it for multiple businesses. Vestas is now a customer of these same facilities; but because they are more fully realized, Vestas still is able to get competitive costs without the painful fixed-cost impact in slower cycles. 

In a way, this is similar to Apple's business model. Vestas designs its systems, and manufactures key components like composite turbine blades. Controlling key manufacturing, while outsourcing less critical parts, has led to a more profitable business, with a better capital structure in the slower years of the cycle. 

There's strong evidence that management's plan is working: The company has paid down more than $1.4 billion in debt since 2012, while cash and equivalents has doubled to nearly $1 billion. 

Solar player with energy giant on its side 
SunPower (NASDAQ:SPWR) is one of the best solar-panel makers, with a strong technology lead over its competitors. Not only are SunPower's panels some of the most efficient, but on a cost per-watt basis, the premium price for its panels is actually a bargain in terms of power generation during the panel's life.

SunPower is a serious global player in utility-scale solar plants. With French energy giant Total SA (NYSE: TOT), the majority shareholder and an active partner, the company is well-positioned for international growth in utility-scale solar. But it doesn't end there. 

SunPower is also one of the biggest players in distributed solar, using a network of dealers for smaller residential and commercial customers, while handling the largest and most complex customers in-house. The company also has in-house financing, meaning it is fully integrated from manufacturing to after-sale support, and every step in between. Solar is growing more competitive, but it's a huge market that is growing at double-digit rates. 

SunPower is expanding its production capacity after running at almost max output for all of 2014. This additional capacity will not only allow for growth, but will further reduce the company's costs per unit based on improved processes and better technology.

SPWR Chart

SPWR data by YCharts.

After an incredible run since late 2012, the stock price is down more than 40% since July. Now looks like a fantastic time to buy. 

Cheap oil makes this company even more important 
Core Laboratories (NYSE:CLB) is dependent on demand for oil -- there's no getting around that. Its business is focused on helping drillers unlock oil in shale and in deepwater projects around the world -- the two most expensive places to produce oil. As a result, you'd think today's oil-price environment would be disastrous.

Really, the opposite is true. Independent producers that hold leases on shale plays have to find a way to produce profitably on their existing leaseholds. Offshore production can be even tougher, with energy companies paying as much as $500,000 per day on long-term contracts for drillships, whether they drill or not. Core Lab's business -- helping get more production for lower costs -- has never been more needed.

Core's technical expertise helps these companies increase output, which leads to lower production costs. Producers are already cutting back on drilling for 2015, and you can rest assured that the focus will be on operational efficiency and maximizing the return on existing wells. Core Laboratories may be in the best position of any oilfield services company right now. 

CLB Chart

CLB data by YCharts.

During the past five years, Core Lab has doubled earnings per share, increased free cash flow almost 50%, and seen its stock double. However, it has fallen nearly 50% since April -- a victim of a fearful market that doesn't seem to fully understand its business. 

Well positioned for today and tomorrow
The most successful investors don't get caught up in the short-term noise. This is important to consider, as all three of these companies are likely to be volatile investments. However, ignoring the short-term ups and downs of the stock market, and focusing on the long-term outlook and prospects of the businesses themselves, offers a look at three solid companies that are well-run and operating in industries with significant room for growth in the years ahead. 

The future of energy will depend on many sources -- both renewables like wind and solar, and continued development of oil and natural gas. These are three of the most important companies in each of those industries.

Do they fit into your portfolio? Take a closer look; there's a good chance one of them is right for you.