It's tough knowing where to invest right now. The stock market has been in the doldrums all year, and 2023 isn't looking much better. There are serious concerns that the Federal Reserve will push interest rates too high and cause a steep economic downturn.

But if we look past all this uncertainty, we can see a few longer-term growth trends that should remain strong over the coming years. Three of the biggest megatrends are:

  • Decarbonization: The economy is transitioning to lower-carbon energy sources.
  • Digitization: Businesses are undergoing digital transformation initiatives to bring more of their business processes online.
  • Deglobalization: Countries are shifting their supply chains onshore to improve their resilience.

Because of that, companies working to capitalize on these themes should thrive in the coming years. That's why the best place to invest $5,000 (or any other amount) is across these megatrends. Here are five companies aligning their businesses to capitalize on one or more of these themes.

The data infrastructure leader

American Tower (AMT -0.26%) is one of the largest global real estate investment trusts (REITs). The company operates 222,000 communications sites worldwide and over two dozen U.S. data centers. 

This infrastructure is crucial for increased digitization. Growing data use from 5G, streaming, cloud computing, and other digitization trends is driving the need for more mobile-communications infrastructure and data centers. According to one estimate, companies must invest $1 trillion over the next five years to upgrade global data infrastructure.

That should enable American Tower to add more tenants to its existing towers and data centers, develop new sites, and continue to acquire locations. These drivers position the REIT to continue growing its cash flow and dividend at above-average rates over the next few years.

The megatrend infrastructure investor

Brookfield Infrastructure (BIPC -0.47%) (BIP -1.33%) is a global infrastructure investor with operations across the utility, energy midstream, transportation, and data sectors. The company is increasingly focused on investments aligned with the digitization, decarbonization, and deglobalization trends. 

Brookfield has built a leading data infrastructure portfolio with towers, fiber optic networks, and data centers. It's also capitalizing on deglobalization by helping semiconductor giant Intel onshore manufacturing capacity by financing the construction of two new plants in the U.S.

On top of that, it's investing in several decarbonization initiatives. The company expects these themes to power organic growth at or above the top end of its 6% to 9% annual target range in the coming years. That should support 5% to 9% annual dividend growth. 

Securing the digital transformation

Palo Alto Networks (PANW -1.71%) is a global leader in cybersecurity. Network security is becoming increasingly important as more companies digitize their businesses and hybrid work becomes the norm.

Meanwhile, cyberthreats are growing more complex and costly. According to Cybersecurity Ventures, global cybercrime costs will balloon to $10.5 trillion annually by 2025, up from $3 trillion in 2015. Palo Alto Network built a three-platform strategy to help clients secure their digital transformation. That's leading it to gain market share as customers consolidate their network security with the company's integrated platform and best-of-breed capabilities. 

The logistics real estate leader

Prologis (PLD 0.17%) is the global leader in logistics real estate, with 1 billion square feet of space across 19 countries. Demand for warehouse space has skyrocketed since the pandemic, driven by the accelerated adoption of e-commerce and shifting inventory-management practices to improve supply chain resiliency.

These digitization and globalization drivers have the REIT expecting to grow its same-site net operating income at an 8% to 10% annual rate for the next few years as legacy leases expire and are repriced to higher market rates. In addition, the company expects to develop additional warehouse capacity.

According to global commercial real estate company CBRE, the U.S. will need an additional 330 million square feet of distribution space by 2025 to handle the expected growth of e-commerce sales alone.

The clean energy king

NextEra Energy (NEE 0.51%) is the world's largest producer of wind and solar energy and a global leader in battery storage. It's investing billions of dollars annually to grow its renewable energy capacity and build additional clean energy infrastructure.

These investments have the utility on pace to grow its adjusted earnings per share by as much as 10% per year through 2025. That should support around 10% annual growth in its dividend through 2024. Overall, the company sees upward of $4 trillion in investment opportunities to fully decarbonize the U.S. economy over the next 30 years.   

Positioned to prosper

Over the coming years, companies will invest trillions of dollars in digitizing, decarbonizing, and deglobalizing their operations. That will benefit the companies focused on capitalizing on these megatrends, like American Tower, Brookfield Infrastructure, Palo Alto Networks, Prologis, and NextEra Energy. Because of that, investors could do very well by investing $5,000 across those five stocks over the next five years.