PHOTOGRAPH BY IMAGINECHINA VIA AP

To most people, myself included, this week’s agreement between the United States and China on tackling climate change came as a big surprise. For more than a decade, the Chinese government has resisted international calls for it to place a cap on carbon emissions, arguing, with some justification, that its first priority was industrializing its economy, expanding its G.D.P., and raising living standards. As recently as September, at a U.N. climate summit, China refused to say when its production of CO 2 would peak. But here was President Xi Jinping pledging that, by 2030, his country’s carbon emissions would max out, and energy from renewable sources would meet twenty per cent of its total energy needs.

In a sense, there’s less to the deal than meets the eye. It’s non-binding, and, as the White House statement about it makes clear, the dates aren’t necessarily firm. China has said that “it intends” to make sure its emissions will peak “around 2030,” and that the share of the energy it consumes that comes from non-fossil fuels rises to “around 20%.” The United States has said it “intends to achieve an economy-wide target of reducing its emissions by 26%-28% below its 2005 level in 2025.”

Clearly, there’s wiggle room on both sides. However, the fact that the world’s two largest polluters have agreed to work together on this issue, rather than sniping at each other from afar, is important. A major problem with the 1997 Kyoto Protocol was that it exempted China, India, and most other developing countries from imposing restrictions on emissions. (That failure prompted the Bush Administration, in 2001, to say that the United States was dropping out and wouldn’t honor the protocol.) Now, for the first time, there appears to be the possibility of a larger international agreement, a successor to the Kyoto treaty, that would encompass developed and developing nations. If such an arrangement could be constructed, it would mark the first serious effort to tackle climate change on a global, rather than a regional, basis.

In short, China’s change of heart is a big deal. But what lies behind it? And it is for real?

The first point to note is that the shift isn’t as sudden as it appears. Although the government in Beijing has been unwilling to make international commitments on global warming, it long ago recognized the existence of the problem, and took some internal measures to alleviate it. In 2007, during the premiership of Hu Jintao, the Chinese authorities formulated a National Climate Change Program, which was intended to “build a resource conservative and environmentally friendly society.”

At a time when China was building coal-fired power plants across the country to meet the soaring demand for electricity from a rapidly growing economy, it was easy to scoff at such a declaration. (Between 2005 and 2009 alone, China added coal capacity equivalent to all the coal-fired plants in the United States.) But the Chinese, in their own way, were serious. In addition to putting up new coal-fired plants, they invested heavily in nuclear, wind, hydroelectric, and solar power. The government set a target of ten per cent for the proportion of energy generated from renewable sources in 2010. China didn’t hit this figure on schedule, but, four years later, it has just about reached the target—meaning it supplies about the same share of its energy needs with renewables as the United States does (based on figures from the U.S. Energy Information Administration). And, even before this week’s announcement, the Chinese government had already raised its goal for renewables, to fifteen per cent of its total energy needs by 2020.

To help reach this target, the country is still investing heavily in alternative-energy projects. Indeed, according to figures compiled by Bloomberg New Energy Finance, China now accounts for about thirty per cent of worldwide investment in renewables—more than Europe or the United States. China’s new projects include solar-energy plants and offshore wind farms. Last year alone, according to Bloomberg, the country installed twelve gigawatts' worth of solar panels, which is about equal to all the solar capacity in the United States.

At the same time, of course, China has been building more coal plants. Indeed, coal still accounts for more than seventy per cent of the country’s energy consumption. This has come at a high price: horrible smog in many of China’s cities, including Beijing. When the Beijing Marathon was run recently, the city’s air-quality index, which measures how much pollution there is in the air, was more than sixteen times the level that the World Health Organization deems healthy.

The high levels of pollution are an embarrassment to the Communist regime. In advance of this week’s Asia-Pacific Economic Cooperation summit, the government closed down many coal plants in the neighboring Hebei province, leading some Beijing inhabitants to dub the resulting clear skies “APEC blue.” But the country’s image is far from the only issue. Among the Chinese population, asthma has turned into a chronic problem; in 2012 alone, according to one study, nearly seven hundred thousand people died from smog-related causes. Responding to growing public concerns, the government earlier this year vowed to take action. Li Keqiang, China’s second-ranking official, told the country’s parliament, “We will resolutely declare war against pollution, as we declared war against poverty.”

In the past, China has always regarded serious efforts to tackle environmental concerns as too costly, in terms of foregone jobs and G.D.P. But the country’s thinking is starting to change. And that, ultimately, is what offers the most hope for a greener China, even as, for the next decade or more, it will continue to build more coal plants and emit more CO 2 .

It’s not that the Chinese have downgraded economic growth: far from it. The country’s current Five-Year Plan envisages the continuation of its current rate of G.D.P. growth, which is about seven per cent. Its next Five-Year Plan, which it will adopt in early 2016, will doubtless feature a similar target. What’s different is where that growth will come from. As the Chinese economy starts the shift from manufacturing to services that all developing economies make sooner or later, more of the country’s growth will come from industries that don’t use energy so intensively, such as health care and entertainment. And that, rather than any diktat or international agreement, will be what enables China, eventually, to combine rapid economic development with lower carbon emissions.

Or, at least, that is how some of the smartest people in the Chinese government see things evolving. “Healthcare, education, information technology, sports, and the cultural and entertainment industries will all enjoy great potential for rapid growth,” Ma Jun, the chief economist at China’s central bank, wrote in a recent article. “Real estate, the automobile industry and the construction materials’ industry, on the other hand, will likely face a prolonged period of profit deceleration and weaker investment in the medium and longer run. The proportion of heavy, polluting industries in economy will decrease.”

According to this vision, policy developments will also play a role. Cleaner energies will be substituted for coal (or, possibly, practical carbon-sequestration technologies will emerge), there will be more investment in public transportation, and, in 2016, according to officials, China will introduce a national cap-and-trade system for carbon emissions. (A number of cities are currently experimenting with local schemes.)

Will it all be enough to prevent China from boiling the planet, a possibility raised by Jonathan Watts in his 2010 book, “When a Billion Chinese Jump”? Even after this week’s developments, there’s not yet a definitive answer to this question. But things are looking a bit brighter, and not just for residents of Beijing.