Renewable energy, particularly solar energy, was one of the best-performing industries in 2020 -- with the Invesco Solar exchange-traded fund (ETF) (TAN -0.28%) rising over 233% that year while the energy sector fell over 36%. Since Jan. 1, 2021, however, the Invesco Solar ETF is down 31% while the energy sector is up over 66%. The energy sector is a bit of a misnomer, as it mainly contains oil and gas companies while solar companies typically fall in the technology, utility, or industrial sector.

The 180-degree flip was swift and brutal for investors who jumped out of oil and gas and into renewable energy. Here's why oil and gas is doing well while renewable energy stocks are on the decline, as well as some investment strategies worth considering now.

Silhouette of a man standing with his left leg on the cracked earth representing fossil fuels and his right leg on lush grass representing renewable energy.

Image source: Getty Images.

Why oil and gas companies are thriving

After being the worst-performing sector in 2020 and the best-performing sector in 2021, energy continues to be the best-performing sector so far in 2022.

^IXE Chart

^IXE data by YCharts

In fact, it's the only sector that is positive for the year, with the 10 other sectors as well as the S&P 500, Nasdaq, and Dow Jones Industrial Average all down year to date. 

Unlike many industries that are reacting to higher inflation, oil and gas is one of the primary causes of inflation. Higher oil and gas prices affect consumers at the pump and through utility costs. On the industrial and commercial front, they raise costs throughout the transportation industry -- from shipping and logistics companies to airlines, to package delivery companies.

Oil and gas prices are rising for the exact opposite reason they declined in 2020. In 2020, demand crashed due to the pandemic, and the industry was left blindsided and oversupplied. After reducing costs and not reinvesting to maintain production output, the industry is now undersupplied while demand is rising as the economy rebounds.

In addition to insufficient supply to satisfy demand, many large and small oil and gas companies have implemented major strategic changes. The short- to medium-term shift is a transition from high spending and high growth toward positive free cash flow and stable growth. The long-term shift is ramped up investment in alternative and renewable energy and decarbonizing of existing operations. Combined, these new strategies result in less traditional oil and gas investment.

So far, it appears that companies haven't increased production in response to higher demand and prices to the same effect as in past booms. On Jan. 18, ExxonMobil (XOM 1.15%) announced its goal for net-zero greenhouse gas emissions by 2050, making it the last of the oil majors to set this goal. In early December, Exxon announced net-zero emissions from its Permian Basin operations by 2030. 

Since the industry isn't ramping up production in response to higher prices, companies get to enjoy higher margins because prices are staying high -- all the while keeping healthy balance sheets and investing in the energy transition.

Why renewable energy companies are struggling

Renewable energy is now cost-competitive with fossil fuels at scale. But developing those projects takes time and a lot of money.

Rising interest rates make development projects more expensive and can reduce the return on invested capital. Inflation makes goods and services more expensive, which can compress margins. Inflation can reduce profitability even if revenue is growing at a good pace. Higher raw material costs and supply chain issues are yet another headwind weighing on margins.

Finally, regulatory uncertainty is an ongoing concern in the renewable energy space. The industry is, in a way, a victim of its own success. Since the economics have improved, we could see less state and federal support. The Build Back Better Plan is pro-renewables -- but it remains to be seen if it will get passed.

In short, renewables remain a growth industry that is vulnerable to a weakening economy, high inflation, and rising interest rates. On top of that, many solar and wind energy stocks rocketed higher too far, too fast in 2020, which left them a lot of room to fall in 2021 and 2022 given the headwinds discussed and valuation concerns.

What to do now

Despite higher equity valuations, the energy sector remains one of the best places to find high-yielding dividend stocks. For example, pipeline giant Kinder Morgan (KMI 3.46%) intends to raise its dividend to $1.11 per share per year, which represents an annual yield of 6.4%. Chevron (CVX 1.54%), having never cut its dividend for over 35 years, has a yield of 4.2% and still sports one of the best balance sheets of the oil majors.  

Meanwhile, the renewable energy industry is now chock-full of good buys, as many industry leaders are down well off their highs. Companies like Clearway Energy, Brookfield Renewable, and NextEra Energy all invest in renewable energy infrastructure projects and pay attractive dividends too.

In sum, there's no need to jump out of renewable energy and into oil and gas because the industry is doing better right now. Rather, it's best to take what the market gives you -- whether that's through high-yield oil and gas dividend stocks or renewable energy leaders on sale.