Chinese leader Xi Jinping and President Obama struck a deal Wednesday to limit greenhouse gases, with China committing for the first time to cap carbon emissions and Obama unveiling a plan for deeper U.S. emissions reductions through 2025.

China, the world’s biggest emitter of greenhouse gases, pledged in the far-reaching agreement to cap its rapidly growing carbon emissions by 2030, or earlier if possible. It also set a daunting goal of increasing the share of non-fossil fuels to 20 percent of the country’s energy mix by 2030.

Obama announced a target to cut U.S. emissions 26 to 28 percent below 2005 levels by 2025, the first time the president has set a goal beyond the existing 17 percent target by 2020.

The announcement capped a trip that also resulted in steps to cut tariffs on technology products, adopt warning measures to reduce the chance of accidental military conflict, and ease visas.

The two countries together account for about 45 percent of the world’s greenhouse-gas emissions, and their commitments are likely to energize talks underway to set new post-2020 targets when climate negotiators meet in Paris in December of next year. “The announcement provides a real shot of momentum for international climate negotiations,” one administration official said before the Obama-Xi announcement.

President Obama stands with Chinese President Xi Jinping as they listen to the Chinese national anthem during a welcome ceremony in the Great Hall of the People in Beijing on Wednesday. (Greg Baker/Agence France-Presse via Getty Images)

“We have a special responsibility to lead the global effort against climate change,” Obama said of the two nations at a joint news conference. “Today, I am proud we can announce a historic agreement.”

Meeting the goals will be difficult for both countries.

China completes a new coal plant every eight to 10 days, and while its economic growth has slowed, it is still expanding at a brisk rate of over 7 percent.

The scale of construction for China to meet its goals is huge even by Chinese standards. It must add 800 to 1,000 gigawatts of nuclear, wind, solar and other zero-emission generating capacity by 2030 — more than all the coal-fired power plants that exist in China today and close to the total electricity generating capacity of the United States.

In the United States, Obama faces stiff opposition on climate issues from Republicans, who want to use their control of Congress to curb the power of the Environmental Protection Agency to limit carbon emissions from power plants, a key part of Obama’s “climate action plan.”

And to meet its target, the United States will need to double the pace of carbon pollution reduction from 1.2 percent per year on average from 2005 to 2020 to 2.3 to 2.8 percent per year between 2020 and 2025.

But Xi and Obama have both made climate measures a priority.

China’s announcement is the culmination of years of change in attitudes among Chinese now fed up with dire levels of pollution that a study in the British medical journal the Lancet blamed for 1.2 million premature deaths in 2010 alone. China has cap-and-trade pilot programs in five provinces and eight cities. It is also the world’s largest investor in solar and wind energy.

Moreover, it has barred coal-plant construction in some regions. Such construction has dropped from more than 90 gigawatts in 2006 to 36.5 gigawatts in 2013, according to the World Resources Institute.

The joint climate announcement could undercut U.S. critics who have said that limiting greenhouse gases is pointless while China refuses to join such efforts. And it could quiet those in China who have argued that carbon emissions should be measured on a per capita basis or by improvements in energy intensity.

“It is imperative that these two countries — the world’s largest emitters of greenhouse gases — show real leadership. This is an important start,” said Phil Sharp, president of Resources for the Future. “Agreements like this are more important than they might appear at first glance, because in both countries there are political factions that justify inaction by pointing at the failures of the other country.”

Obama administration officials called the climate agreement a “historic step” that came together after months of negotiations, beginning when Secretary of State John F. Kerry raised the subject on a trip to Beijing in February. Obama followed up with a letter to Xi in the spring and met with Vice Premier Zhang Gaoli during the U.N. General Assembly in September. Chinese officials expressed interest in pursuing a deal that could be completed ahead of the ­Asia-Pacific Economic Cooperation meetings here this week, administration aides told reporters in a background briefing Wednesday.

Whether Obama’s target can be set now and achieved technologically — or enforced years after he leaves office — remains unknown.

U.S. officials said they were confident the president possesses the authority to set the new climate targets without additional authorization from Congress.

But Senate Republican leader Mitch McConnell (Ky.) said “this unrealistic plan, that the president would dump on his successor, would ensure higher utility rates and far fewer jobs.”

Other Republicans joined McConnell in criticizing the deal. Sen. James M. Inhofe (R-Okla.), who is widely expected to assume the chairmanship of the Senate Environment and Public Works Committee in January, called the pledges by Obama and Xi “hollow and not believable,” and he suggested that the agreement was tilted in China’s interest.

“The United States will be required to more steeply reduce our carbon emissions while China won’t have to reduce anything,” Inhofe said.

Around the globe, the pact was widely praised. Leaders of the European Union, which last month pledged a 40 percent reduction in emissions by 2030, said the new commitments by China and the United States provided an important boost to negotiations on a global climate treaty in late 2015.

“These two crucial countries have today announced important pathways towards a better and more secure future for humankind,” said Christiana Figueres, the European Union’s top official on climate change.

A second Obama administration official said that it is uncertain whether other countries will seek to join the United States and China in pursuing new standards.

“Climate negotiations have been fraught for 20 years,” this official said. “There are 190-plus countries in these tough negotiations, and it’s not like they will all fall into place in five minutes. But this a really important step.”

Earlier, the United States and China reached agreements designed to defuse tensions over international trade and military maneuvers, even as both leaders courted other Asian nations attending the APEC forum in Beijing to join separate trade pacts.

Chinese and American trade negotiators agreed Tuesday to eliminate tariffs on $1 trillion a year of global sales of information and communications technology, including dozens of high-tech products such as GPS devices, medical equipment and game consoles. U.S. Trade Representative Michael Froman called the deal a “breakthrough” that could boost trade and create jobs.

The agreement now goes to the World Trade Organization, where 52 nations must approve. If they do, it would be the first major WTO agreement since 1996.

The deal would benefit U.S. companies seeking greater access to China as well as U.S. and Chinese companies with plants in China aimed at making products for the American market.

The APEC summit also has provided a venue for high-level encounters between heads of state. Obama held his first face-to-face conservations with Russian President Vladi­mir Putin since June, seeking to make headway on the conflict in Ukraine, the civil war in Syria and negotiations over Iran’s nuclear program. The two leaders spoke three times, for a total of 15 to 20 minutes, on the sidelines of the APEC meetings.

Mufson reported from Washington. Joby Warrick in Washington contributed to this report.