The two largest contributors to global carbon emissions, China and the United States, have ratified the hallmark Paris agreement to battle climate change.

The countries' ratification could help put the pact into force before the end of the year.

President Xi Jinping of China and US President Barack Obama called Saturday's announcement a milestone. Obama said the climate deal is "the moment we finally decided to save our planet".

China and the US are responsible for about 40 percent of total global carbon emissions. Other countries are expected to follow China and the US and ratify the deal later this month during the UN Climate Change Week. "Hopefully this will encourage other countries to make similar efforts," President Xi said after today's announcement.

"The signal of the two large emitters taking this step together and taking it early, far earlier than people had anticipated a year ago, should give confidence to the global communities and to other countries that are working on their climate change plans, that they too can move quickly and will be part of a global effort," senior Obama adviser Brian Reese said.

READ MORE: COP21 - Any agreement is better than no agreement?

The climate accord was signed last year in Paris. Its main goal is to slash greenhouse gas emissions and keep global temperature increases to "well below" two degrees Celsius. In the Paris agreement China and the US have committed to cutting levels of emissions by 2030. "There's an American saying: You need to put your money where your mouth is. That's what we're doing," President Obama said.

"The timing of this announcement is important because it comes a few hours before the start of the G20 Summit," Al Jazeera's Adrian Brown, reporting from Hangzhou, said.

"For the accord to go into legal effect, however, at least 55 countries need to ratify the agreement. What China and presumably the US will do is set an example for other countries to follow."

Before today's announcement only 23 countries, responsible for about 1 percent of global emissions, had ratified the treaty.

To cross this legal threshold UN Secretary-General Ban Ki-moon said he would hold a high-level event in New York to which he would invite country leaders to formally ratify the Paris climate change agreement.

Experts have said that target is already in danger of being breached. The UN weather agency said that 2016 is on course to be the warmest since records began.