Don't look now, but solar energy stocks are crushing the market -- and fossil fuel stocks -- in 2020. This follows years of underperformance by most solar energy stocks and a year when it was feared that the pandemic would grind the industry to a halt. 

But instead of folding under the pressure of economic uncertainty, solar stocks have exploded. There are a few reasons why, and it's worth understanding what's sustainable in the coming years and could keep driving solar stocks higher. 

FSLR Chart

FSLR data by YCharts

The pandemic wasn't what we thought it was

In the spring, there was some worry that the COVID-19 pandemic would be a huge burden for the solar industry in 2020. Residential solar sales could be impacted because companies wouldn't be able to sell door-to-door, manufacturing could be shut down, and costs could rise to keep workers and customers safe. 

But that's not what happened. In fact, the construction industry has been booming in 2020, so residential solar has been relatively strong. Outdoor working conditions have also been deemed relatively safe, so solar projects around the world have gone on as planned as well. 

The pandemic has also brought about some innovations that were a long time coming for solar energy. One, in particular, is that residential solar companies were forced to make more sales with digital tools. SunPower (SPWR -2.65%) is one of the leaders in this digital-first approach, but Tesla (TSLA -1.72%) has also pulled all of its door-to-door staff in favor of online sales. Even Sunrun (RUN -0.15%) is adapting to the new reality with fewer physical touchpoints with consumers during the sales process. 

Large solar farm in the desert on a sunny day.

Image source: Getty Images.

Politics as usual

It's also not a surprise that solar stocks have gone up as presidential candidate Joe Biden has taken a clear polling lead over President Trump. Biden has clearly put more of a focus on clean energy than Trump, despite not being a supporter of the "Green New Deal", so the perception is that he'll be good for the industry. 

Even if Biden supports more favorable policies toward the solar industry, it isn't like the last four years have been bad for solar energy. You can see below that solar energy production has grown exponentially for a decade, and is up nearly 300% in the last five years alone. 

US Solar Energy Production Chart

US Solar Energy Production data by YCharts

Politics can often drive traders into and out of industries, so it's a reason solar stocks are up this year. But politics has not typically been a driver of the fundamental financial health of solar companies, which is ultimately what's helping solar stocks in 2020. 

The biggest reason solar stocks are up in 2020

At the end of the day, the reason solar stocks are up this year is that financial performance is improving. Below is a chart of revenue and gross margins for Canadian Solar (CSIQ -0.83%), JinkoSolar (JKS -0.18%), SolarEdge (SEDG -2.94%), and Enphase Energy (ENPH -2.32%), four of the biggest equipment suppliers in the industry. Not only did we not see a decline in revenue from the pandemic, but some companies are also seeing margins increase. 

CSIQ Revenue (TTM) Chart

CSIQ Revenue (TTM) data by YCharts

The financial improvement comes after the industry made a number of moves to focus more on small segments of the market rather than vertically integrating. For example, SunPower has sold or spun off its development business, inverter manufacturing, and its solar manufacturing arm. The result has been better financial results and better margins almost across the board. 

Can the run continue? 

Solar stocks may be up big this year, but they're not running out of room to run. The industry is still expected to grow as the cost of power from solar panels falls and replaces fossil fuel as a preferred new source of electricity. Manufacturers and installers also have room to expand margins after years of breakeven results or even losses.  

The industry has gone through boom and bust cycles before and that's not out of the questions, but what's different now is there are fewer competitors and companies are more focused on a specific segment of the market rather than competing up and down the value chain. As a result, I think solar energy stocks still have a lot of room to grow and may stay the hottest in energy in 2021. This is the future of energy, and the companies I've mentioned are building businesses that could be consequential for our energy use for decades to come.