California has passed a law committing to exclusively carbon-free electricity sources by 2045, setting it against US President Donald Trump's energy policy.
"There is no understating the importance of this measure," Governor Jerry Brown said, and vowed to honour the 2015 Paris climate deal.
Last year Mr Trump said he would pull the US out of the deal and negotiate a new "fair" deal for US businesses.
California is the second US state after Hawaii to commit to carbon-free energy.
Were it to be an independent country, California would have the fifth largest economy in the world, trailing only Germany, Japan, China and the US.
At a signing ceremony in the state capital Sacramento, Mr Brown vowed to meet the terms of the Paris agreement and to "continue down that path to transition our economy to zero carbon emissions".
Under the terms of the legislation, all utility companies must get 60% of their energy from renewable sources by 2030.
By 2045, all Californian electricity must come from carbon-free or renewable energy.
A report released by the state's energy commission estimated that in 2017 around one third of retail electricity sales in California came from renewable sources.
Environmental activists enthusiastically backed the measure, but there was opposition from some of the state's largest utility companies.
A statement from Pacific Gas & Electric spokesperson Lynsey Paulo reportedly said prices could rise for customers thanks to the new law.
"If it's not affordable, it's not sustainable," it read.
The new law comes days before Mr Brown hosts the Global Climate Action Summit in San Francisco.
Politicians, business leaders and celebrities will attend, and sponsors include the UN, Facebook and Google.
The legislation also marks the latest conflict between California and President Trump, with the state repeatedly defying the administration's policies on everything from energy to civil rights to immigration.