Democrats hold a two-thirds majority in both the Assembly and the Senate. But in pushing the bill through, Mr. Brown had to navigate moderate Democrats, who were nervous voting for a measure that could raise the cost of gasoline, as well as objections from Republicans, who have often opposed such measures as costly for consumers and businesses.
In addition, one Democratic member of the Assembly was absent this week, putting pressure on Democrats to recruit some Republican support.
While the business community was supportive of the bill, environmentalists — a critical constituency in the state — were split: Some opposed it, arguing that the bill was not tough enough on industry.
The cap-and-trade bill extends a program that otherwise would have ended in 2020. Kevin de Leon, the Democratic president of the Senate, and one of the leaders of the effort to extend the law, expressed satisfaction at the vote.
“Californians overwhelmingly support our efforts to tackle climate change,” he said. “They know it’s an urgent threat and they want us to continue to lead.”
Mr. Brown has become a global advocate for efforts to battle climate change since the election of Mr. Trump. Last month he went to China, where he met President Xi Jinping to discuss the need for cooperation to reduce global emissions. In testifying before the Legislature, he presented California’s cap-and-trade bill as a model for other states and nations.
“This isn’t about some cockamamie legacy,” Mr. Brown posted to Twitter after the testimony. “This isn’t for me, I’m going to be dead. It’s for you & it’s damn real.”