Mexican President Felipe Calderon has signed a law introducing binding targets on climate change.
Mr Calderon said on Twitter  that the law would make Mexico the "first developing country with integral legislation against climate change".
The law, which sets targets on reducing greenhouse gas emissions and increasing the use of renewable energy, is only the second of its kind in the world.
The measures had been passed by the Senate in April by 78 votes to nil.
"Mexico is committed to reducing greenhouse gas emissions by 30% by 2020 and by 50% by 2050," Mr Calderon said in another tweet.
"This law is part of the all the efforts that have made Mexico an international leader in environmental protection," he added.
The law was signed on Tuesday, the UN Environment Programme's World Environment Day.
As well as setting a target on greenhouse gas emissions, it stipulates that 35% of Mexico's energy will have to come from renewable sources by 2024, and that government agencies will be obliged to use renewables.
Despite being the sixth-largest oil exporter in the world, correspondents say the oil sector has been declining in importance in Mexico in recent years.
The law also provides for the establishment of a trading scheme for greenhouse gas emissions permits.
The only similar legislation to have been enacted so far elsewhere in the world was introduced by the UK government in 2008. It pledged to reduce greenhouse gas emissions by at least 80% by 2050.