SACRAMENTO, Calif. — California lawmakers approved a $900 million spending package devoted to environmental programs Wednesday, hours after Gov. Jerry Brown and Democratic legislative leaders agreed to spend nearly two-thirds of the available money generated by the state’s cap on carbon pollution.

The deal, reached as lawmakers pressed to finish the two-year legislative session, includes $363 million for clean vehicle incentives and hundreds of millions for urban plants and efforts to create cleaner air in disadvantaged communities. It also includes $50 million to reduce emissions of methane and other climate-changing gases associated with landfills and dairy production.

The agreement is the product of negotiations between Brown, Senate President Pro Tem Kevin de Leon of Los Angeles and Assembly Speaker Anthony Rendon of Paramount, all Democrats.

“This plan gets us the most bang for the buck,” Brown said in a statement. “It directs hundreds of millions where it’s needed most – to help disadvantaged communities, curb dangerous super pollutants and cut petroleum use – while saving some for the future.”

The deal comes just a week after Democrats voted to extend California’s landmark climate change law, the most aggressive in the nation, by another 10 years, solidifying the state’s reputation as an environmental leader through at least 2030. That move, pushed by Brown and environmentalists, came amid fierce opposition from oil companies and other business interests.

The compromise ends two years of indecision over what to do with $1.4 billion in revenues collected from California’s fee on polluters, known as cap-and-trade. About 60 percent of program revenues are earmarked for specific projects including high-speed rail. The spending announced Wednesday covers the remaining 40 percent and also leaves $462 million for future years.

De Leon had proposed spending nearly all the available funds, and Rendon and Brown, who advocated a more frugal approach, particularly given plummeting revenue and uncertainty about the program’s long-term viability.

It comes just a week after Democrats voted to extend California’s landmark climate change law, the most aggressive in the nation, by another 10 years, solidifying the state’s reputation as an environmental leader through at least 2030. That move, pushed by Brown and environmentalists, came amid fierce opposition from oil companies and other business interests.

Pollution permits consistently sold out after the cap-and-trade program began in 2012, regularly generating billions of dollars to combat climate change. But demand this year has plummeted amid a legal challenge that threatens to end the program.

Republicans have consistently opposed the program as an illegal tax and rejected the spending plan Wednesday.

The money “goes to many Democrat pet projects throughout the state at the expense of wildfire prevention issues and pursues long-term greenhouse gas reduction goals that will continue to harm families and jobs,” said Sen. Jeff Stone, R-Temecula.

Lawmakers also took up companion legislation that would require steep reductions in a variety of climate-changing gases known as short-lived climate pollutants, including methane, HFC gases used in aerosols and air conditioning refrigerants and soot, known as black carbon. While these pollutants live in the atmosphere for relatively short periods, they have an outsized impact on climate change, according to legislative researchers.

The compromise package, tied to the $50 million in methane emissions funding, would set a requirement that dairies and livestock producers reduce methane emissions to 40 percent below their 2013 levels by 2030. It allows for the regulation of cow flatulence — another source of methane emissions — if experts determine that technology exists to reduce it.

California would also be pushed to significantly increase composting in order to reduce organic waste, which emits greenhouse gases when it breaks down in landfills. SB1383 sets a goal of reducing the flow of food products to landfills by 50 percent within four years.

It is a compromise between Sen. Ricardo Lara, D-Bell Gardens, dairy interests and some environmental groups. Lara worked Wednesday to round up support in the Assembly. Other environmental groups opposed changes Lara made to ease the transition for the dairy industry, including a delay in implementation until 2024.

“It’s important that we reduce emissions of these super-pollutants rapidly,” said Bill Magavern, policy director for the Coalition for Clean Air, which initially supported Lara’s proposal but dropped its support once the changes were made.