Mario Molina, who shared a Nobel Prize in chemistry for demonstrating the threat to the ozone layer posed by CFCs, chemical compounds often found in refrigerants and hair sprays and whose use was later curtailed by a landmark international accord, died Oct. 7 at his home in Mexico City. He was 77.

The cause was a heart attack, said Lorena Gonzalez, a spokeswoman at the Centro Mario Molina, a nonprofit environmental organization Dr. Molina founded in Mexico City.

Dr. Molina, a Mexican-born U.S. citizen, had a newly minted PhD from the University of California at Berkeley when he joined the laboratory of F. Sherwood Rowland at the University of California at Irvine in 1973 as a postdoctoral fellow.

“The one project that intrigued me the most,” Dr. Molina wrote in a biographical sketch when he received the Nobel Prize, “consisted of finding out the environmental fate of certain very inert industrial chemicals — the chlorofluorocarbons (CFCs) — which had been accumulating in the atmosphere and which at that time were thought to have no significant effects on the environment.”

CFCs were widely used in air conditioner and refrigerator coolants, spray paint, deodorant sprays and other aerosol products. Working with Rowland, Dr. Molina discovered that, far from having no significant effect on the environment, CFCs presented a grave risk to the ozone layer, a thin segment of the atmosphere that absorbs the ultraviolet rays of the sun. Unfiltered, those rays can cause skin cancer and other health problems in humans and damage the natural environment on Earth.

According to research by the two scientists, CFCs released into the atmosphere floated to ever higher altitudes, where they broke down and released chlorine atoms — even one of which could destroy 100,000 ozone molecules.

“We were alarmed at the possibility that the continued release of CFCs into the atmosphere would cause a significant depletion of the Earth’s stratospheric ozone layer,” Dr. Molina wrote.

In 1974, he and Rowland published their findings in the journal Nature. They met fierce resistance from industry leaders whose lucrative businesses relied on CFCs. In 1977, according to the Los Angeles Times, the chief of one aerosol manufacturer alleged that their theory was “orchestrated by the Ministry of Disinformation of the KGB.”

But in 1985, British researchers tracking ozone readings in the Antarctic announced the discovery of a significant thinning — a hole, as it became known — in the ozone layer above the South Pole.

Those findings spurred international action to curb the use of CFCs. Adopted in 1987, the Montreal Protocol regulating man-made ozone-depleting chemicals is today the only treaty ratified by all members of the United Nations. In an obituary for Dr. Molina, Science magazine described the accord as “the most successful international effort to fight climate change and environmental degradation.”

In 1995, the Nobel Prize in chemistry was awarded to Dr. Molina, Rowland and Paul J. Crutzen, a Dutch-born scientist then associated with the Max Planck Institute for Chemistry in Mainz, Germany.

“The thin ozone layer has proved to be an Achilles heel that may be seriously injured by apparently moderate changes in the composition of the atmosphere,” the Royal Swedish Academy of Sciences said in announcing the Nobel.

“By explaining the chemical mechanisms that affect the thickness of the ozone layer, the three researchers have contributed to our salvation from a global environmental problem that could have catastrophic consequences.”

José Mario Molina-Pasquel y Henríquez was born in Mexico City on March 19, 1943. His father was a lawyer and later a Mexican ambassador to several countries. Dr. Molina was drawn to science even as a child and recalled co-opting a bathroom in his family’s home for a makeshift laboratory, where he whiled away hours experimenting with chemistry sets.

He attended boarding school in Switzerland before continuing his studies in Mexico, where he received a chemical engineering degree from the National Autonomous University of Mexico in 1965; in Germany, where he received a graduate degree from the University of Freiburg in 1967; and in the United States, where he received a PhD from the University of California at Berkeley in 1972.

At Berkeley, “I had my first experience dealing with the impact of science and technology on society,” he wrote in the biographical sketch. “I was dismayed by the fact that high-power chemical lasers were being developed elsewhere as weapons; I wanted to be involved with research that was useful to society, but not for potentially harmful purposes.”

After leaving UC-Irvine in 1979, Dr. Molina joined the Jet Propulsion Laboratory at the California Institute of Technology. He later was a professor at the Massachusetts Institute of Technology and at the University of California at San Diego, where he had an appointment at the Scripps Institution of Oceanography.

He served on the President’s Council of Advisors on Science and Technology under Bill Clinton and Barack Obama. In 2013, Obama awarded Dr. Molina the Presidential Medal of Freedom, the nation’s highest civilian honor.

His first marriage, to Luisa Y. Tan, also a chemist, ended in divorce. Survivors include his wife, Guadalupe Álvarez of Mexico City; a son from his first marriage, Felipe Molina of Boston; three stepchildren; two brothers; a sister; and two grandchildren.

Until his death, Dr. Molina was a prominent voice in debates about how best to combat climate change. He spoke to the media, testified before Congress and generally sought to persuade the public of the importance of participating in environmental conservation.

“We started something that was a very important precedent,” he told the New York Times when Rowland died in 2012. “People can make decisions and solve global problems.”

Dr. Molina devoted particular attention to reducing pollution in Mexico City, where residents often endure an oppressive blanket of smog hanging over the metropolis.

“We see clearly that we have a long way to go to have a clean city, clean air,” he told the Chicago Tribune in 2007. “We have some beautiful green mountains that, on a day like today, we just have to imagine. It motivates me that we need to work harder.”