Coal is cheap and relatively abundant. So is natural gas. We can now say the same for renewables.

By 2040, carbon-free electricity will make up 60 percent of installed power capacity worldwide, according to a new analysis from Bloomberg New Energy Finance (BNEF).

The demise of coal is largely driven by the slowdown in consumption in China, and to a lesser extent coal’s decline in North America and Europe.

Just last year, there were questions about whether coal use in China was actually falling, given the inconsistencies in government data. At the beginning of 2016, new data showed a 4 percent drop in electricity generation from coal-fired power plants in China, according to the Institute for Energy Economics and Financial Analysis.

IEEFA now has new data from the Chinese government suggesting a more dramatic decline for coal. Overall coal production is down by 15.5 percent, IEEFA reports.  

“Electricity demand has decoupled from economic activity,” Tim Buckley, IEEFA’s director of energy finance studies for Australasia, wrote in a blog post. “China is diversifying away from coal faster than anyone expected.”

China’s relatively sluggish economy and shift away from manufacturing to a service-sector economy is largely responsible for the decoupling. At the same time, nuclear,solarand wind are up 20 percent year-over-year in China, according to government data.

Emerging economies will be responsible for much of the increase in installed renewables in coming years. China is already leading the world in installing solar and wind. China has plans for 30 gigawatts of wind capacity additions this year alone, and expects to add 15 to 20 gigawatts of solar annually for the next five years.

In its latest New Energy Outlook, BNEF forecasts that renewables will make up 61 percent of deployment in non-OECD countries, led by China and India.

BNEF has lowered its new coal capacity outlook for China by 66 gigawatts from its estimate just one year ago. Developed countries will also continue to move toward cleaner forms of energy, but at a slower pace given flattening electricity demand.

Absent carbon policies, however, coal will not die off. Indeed, far from it. China could still install nearly 190 gigawatts of coal plants before 2020; although there is some question of whether those plants will ever be put into production. IEEFA’s Buckley said earlier this year that many of China’s recent additions of coal plants sit idle.

Natural gas is replacing coal in the U.S., sending coal production to its lowest levels in three decades. But the rest of the world will not take up natural gas as a transition fuel, BNEF argues. Just over a decade from now, new wind and solar will be cheaper than running existing coal and gas generators, BNEF forecasts, especially if carbon pricing is instituted.

Although fossil fuels, and coal in particular, will not be able to compete in a world with strong carbon regulations and cheaper renewables, there are still many factors that could keep fossil fuels the dominant source of energy through 2040, as the International Energy Agency has forecasted.

Southeast Asia is expected to invest heavily in coal in the coming years, and India could install more than 250 gigawatts of new coal capacity alone. But even whether those predictions will come to pass is up for debate. In April, India’s energy minister said that solar is cheaper than coal. Even so, coal is expected to remain the largest source of electricity generation in the Asia-Pacific region through 2040.

Of course, electricity is just one source of carbon pollution. In the U.S., emissions from the transportation sector are now equal to carbon dioxide emissions from the electric power sector, which have been falling in recent years.

A shift to electric vehicles could ameliorate that rise in emissions from transportation, but only if the electric fuel source is clean energy. That is a possibility, but far from a foregone conclusion.

China, the world’s largest economy, may be at the dawn of a transportation transition. Electric vehicle sales are up 99 percent in the past year, according to IEEFA, and could hit a million new vehicles on the road annually by 2017.