The transition to renewable energy is one of the biggest investment megatrends of our lifetime. Over the coming decades, the world needs to invest trillions of dollars to decarbonize the economy. That should power above-average growth for companies focused on those sectors in years to come.

I want to cash in on this megatrend. That's why I've been loading up on renewable-energy stocks. I recently bought a few more shares of NextEra Energy Partners (NEP -0.89%) and Brookfield Renewable (BEPC 0.09%) (BEP 0.19%). Here's why I believe they could generate powerful total returns over the long term.

High-powered total-return potential

NextEra Energy Partners has hit a speed bump in recent years. Surging interest rates have driven up its cost of capital. Not only have borrowing costs risen, but its stock price has lost nearly 70% of its value from the peak in early 2022, driving its dividend yield up to 13%. That has made it more difficult to secure new funding at an attractive rate to refinance existing financing as it matures and obtain new capital for acquisitions. Because of that, the company has had to alter its strategy.

It launched a two-part process to sell its natural gas assets. That will enable it to buy back the convertible-equity portfolio financing (CEPF) it used to make acquisitions. It has also cut its dividend-growth rate from 12% to 15% annually through 2026 down to 5% to 8% per year with a 6% target. The company can achieve that new target level through internally funded high-return, organic-growth projects, primarily repowering existing wind energy facilities.

The company is making progress on its new strategy. Last year, it sold its Texas natural gas pipeline portfolio for $1.8 billion. That sale gave it the cash to retire most of its CEPFs through 2026. NextEra Energy Partners plans to sell its remaining gas-pipeline assets next year to address CEPF buyouts in 2026.

If NextEra Energy can execute its plan, it could produce powerful total returns. It would pay a very lucrative and growing dividend. On top of that, it has significant stock-price appreciation potential as its share price recovers. While there's a high risk of a dividend cut due to its high payout ratio, a reduction could accelerate its recovery by enabling it to retain more cash to fund growth and strengthen its balance sheet. This high upside potential is why I continue loading up on its stock.

Powerful growth drivers

Brookfield Renewable has gotten caught up in the growth concerns weighing on NextEra Energy Partners. Its shares are more than 55% below their high in 2022. That pushed its dividend yield up over 6%.

However, its issues were more a matter of timing than problems with financing. The company grew its funds from operations (FFO) by 7% per share last year despite rising rates and supply chain issues. That was slightly below its target of 10%, largely due to later-than-expected transaction closings in the fourth quarter. It also had one that didn't close because shareholders voted against the deal.

That timing will turn into a tailwind this year, driving accelerated growth. Furthermore, despite the acquisition setback, the company sees abundant opportunities to deploy capital at attractive returns. Because of that, it expects to achieve its goal of growing its FFO per share by more than 10% annually through at least 2028. That will give it plenty of power to hit its target of increasing its dividend by 5% to 9% per year.

Brookfield's dividend income and earnings growth alone could power total-annual returns in the mid-teens from here. Add in a recovery in its stock price, and the upside potential is even more significant.

Massive upside as near-term headwinds fade

NextEra Energy and Brookfield Renewable battled growth headwinds last year due to higher interest rates and other issues. However, they both have tremendous growth ahead due to the enormous amount of renewable-energy investment needed to decarbonize the economy. Because of that, they should recover and then some over the long term. That should give them the power to produce robust total returns, which is why I continue loading up on both stocks.