The world needs to spend $3.5 trillion a year to fight climate change. Meet the biggest reallocation of capital in history

High inflation. Conflict in Ukraine. Political instability. Pain at the pump, and at the meter.

Finding the balance between energy security and greenhouse gas reduction has never been more difficult. Even so, more than a third of the world’s largest public companies have pledged to reach net zero by 2050, and that number is growing: in Britain, France and Germany, it’s more than two-thirds.

I believe these companies have the right idea. Earlier this year, McKinsey estimated that to achieve net zero emissions, an additional $3.5 trillion per year must be invested in physical assets for energy and land-use systems through 2050. This is of the largest reallocation of capital in history.

Great companies and great leaders won’t let the challenges of the moment deter them from making the big decisions and investments needed to transition. Companies that act boldly will position themselves to create new types of sustainable value for the future and seize new market opportunities for their organizations. Companies that don’t will likely find themselves playing catch-up in the decades to come.

We must maintain a reliable, clean, affordable and secure global energy system. Solving this riddle will require a combination of idealism and realism.

It is important to recognize the scale of the challenge: today, 80% of the world’s energy supply comes from coal, gas and oil. As winter approaches in the northern hemisphere, many are understandably more concerned about their bills than energy transition goals. In the developing world, which has done little to create the climate crisis, it is also understandable that access to energy is a top priority.

Even so, it is possible for companies to build momentum toward net zero, while keeping the lights on and serving shareholders. To do this, three principles stand out.

Seize the opportunities offered by the transition

McKinsey analysis shows that demand for green offerings in just 11 categories could drive more than $12 trillion in annual sales by 2030. This explains the wave of capital deployment in sustainable goods and services, including materials, climate technologies and energy. Adopting a private equity mindset – investing at scale in a variety of different technologies and transaction types – is key to making this happen.

Invest in current and future solutions

Net zero by 2050 is an ambitious goal, but 28 years remain. For businesses, the operating principle is to balance short-term “no regrets” moves with big long-term investments. They can start by decarbonizing core operations through initiatives that pay for themselves: efficiency, design, reducing waste and introducing cleaner energy sources. At the same time, companies can gradually introduce emerging technologies and work on processes, such as grid modernization and the conversion of methane delivery systems to clean fuel networks, which will be essential to long-term decarbonization.

With carbon regulations likely to tighten, high-emitting sectors such as steel, cement, mining, chemicals and energy will need to incorporate technologies such as capture, use and storage (CCUS), hydrogen, energy storage and negative emissions. These technologies are expensive but their costs are already falling.

Form partnerships

Maintaining resilience and profitability while scaling up efforts to reach net zero will be complicated, but companies don’t need to go it alone. Partnerships can help.

One possibility is to launch and expand voluntary carbon markets, which could be an economically efficient way to reduce emissions. These work best with many players to buy and sell. Voluntary carbon markets could make clean energy investments more affordable and bring them to market faster. Clean fuel consortia, such as those growing around hydrogen hubs, can accelerate innovation, reduce risk and spread costs.

It is not yet certain that the world will do what it takes to find the $3.5 trillion a year needed for the transition. What is certain is that companies can do their part to support the transition and capture new sources of competitive advantage. The choice is to be part of the wave of change or be swept away by the tides.

Bob Sternfels is the Global Managing Partner of McKinsey & Company.

The opinions expressed in comments are solely the opinions of their authors and do not necessarily reflect the opinions and beliefs of Fortune.

More must-have comments posted by Fortune:

Sign up for the Makeshift Features mailing list so you don’t miss our biggest features, exclusive interviews and surveys.