(Bloomberg) -- After narrowly avoiding blackouts, California faces another bruising test of its power grid Thursday as a heat wave smothering the state builds, driving temperatures to dangerous levels.  

Nearly all of the state is under an excessive heat warning, with temperatures in Sacramento forecast to hit 105 degrees Fahrenheit (40.5 Celsius). Palm Springs is expected to reach 113 degrees. 

The blistering heat will drive up demand for electricity to some of the highest levels in years. Officials have asked homes and businesses to conserve power, and California Governor Gavin Newsom issued an emergency proclamation to free up extra electricity supplies to avoid the type of rolling blackouts that hit the state in 2020. The biggest challenge will hit in early evening, as the sun starts to set on the state’s many solar power plants even as temperatures stay high.

The threat of outages underscores the power grid’s increasing vulnerability as climate change disrupts weather patterns amid the push to transition from fossil fuels to renewable energy. California is enduring its worst drought in 1,200 years, which has slashed hydropower production. At the same time, older gas-burning plants have been closing faster than solar, wind and battery facilities can replace them. 

Also See: California Lawmakers Vote to Keep its Last Nuclear Plant Online

On Wednesday, the California Independent System Operator, which runs the state’s power grid, declared an emergency after tapping all available power supplies. The state managed to avoid rolling outages, but Thursday’s higher temperatures will pose an even bigger test.

“We’ve headed these issues off in the past,” Newsom said at a press conference Wednesday. “We did so last year quite successfully, and I’m confident we’ll do it again this year and this week.”

The extreme heat contributed to Wednesday’s emergency in several ways. Even as it drove up electricity demand, the heat caused some power plants to malfunction, knocking about 1,000 megawatts of electricity offline, Caiso reported. And a fire that erupted in a key mountain pass late Wednesday shut down a transmission line that links Los Angeles to the Central Valley, removing another 700 megawatts. 

“Fortunately, some but not all of those resources are now back in service,” Caiso Chief Executive Officer Elliot Mainzer said Thursday in a video thanking Californians for cutting their power use. “Along with your conservation efforts, our import levels were also in better shape than we anticipated at the beginning of the day. But we are not out of the woods.”

As millions of people crank air conditioners to cope with the heat, demand for power is forecast to hit 46.6 gigawatts. That’s up 3% from Wednesday. A gigawatt is enough to power about 750,000 homes. 

Power prices in the state have surged. The 24-hour average day-ahead price for electricity in Southern California jumped 47% Thursday to $230.95 per megawatt-hour. That’s the highest since February, 2021. 

California’s struggle to meet its power needs will grow more complicated as the state phases out sales of nearly all new, gas-burning cars by 2035 to accelerate the transition to electric vehicles. If all those EVs plug in at sundown when solar fades and supplies are tight, it will be a nightmare for the grid. But if they charge in the middle of the day, when California already has more solar energy than it can use, they could feed power back to the grid in the evening and actually ease electricity shortages.

Read more: Electrifying California cars could either crush or save the grid

The heat is forecast to intensify through Monday, driving up demand for power even higher. It could top 48 gigawatts on Monday and Tuesday, which would be the highest since 2017, according to Caiso.

In a boost to future electricity supplies, California legislators voted to extend the life of the state’s last nuclear power plant by five years as protection against blackouts -- provided the federal government pays much of the cost.

The legislature approved a proposal by Newsom to keep the Diablo Canyon plant, owned by PG&E Corp., running through 2030, rather than closing as previously planned in 2025.

(Adds details about Wednesday’s power emergency in paragraph seven and quotes from Caiso executive in paragraph eight.)

©2022 Bloomberg L.P.