LOS ANGELES — A wiring error during an equipment upgrade sparked a power outage that affected 100,000 customers and shut down a refinery, Southern California Edison said Wednesday.

The error occurred Tuesday morning at the Torrance electrical substation. For the past four years, Edison has been working to increase the capacity of the substation by adding a large power transformer and upgrading circuit-breakers and automated systems.

That included temporarily re-wiring a device that trips a circuit-breaker when it detects an electrical surge or fault, said Paul Grigaux, Edison’s vice president of transmission, substations and operations.

On Tuesday, electrical demand rose after a long Columbus Day weekend. Because upgrade work had isolated a section of the substation, the load was shifted to another section where, due to the wiring error, “it gave this protective device the impression that it was a fault… and tripped a circuit-breaker,” Grigaux said.

Customers lost power for up to about 80 minutes in Hermosa Beach, Redondo Beach, Hawthorne, Gardena and Torrance. That included a refinery owned by PBF Energy in Torrance that evacuated hundreds of workers and burned off petroleum products, creating a flare and thick column of black smoke that could be seen for miles.

Residents of the area south of Los Angeles were urged to remain indoors with windows, doors and air conditioners off.

The refinery was without power for about 20 minutes. After the outage ended, the refinery said it began restarting operations but said the procedure would take days.

The refinery can process an average of 155,000 barrels of crude oil a day and produces gasoline, jet fuel and other products.

It wasn’t immediately clear whether the power outage will affect gasoline prices but the refinery statement said it would be able to meet “all of our commercial obligations in fuel markets.”

Edison said the wiring error has been fixed but further upgrade work at the Torrance substation has been halted until the incident is reviewed.

“It could days, it could be weeks,” Grigaux said. “We’re deeply sorry for the impact that it’s had … we’re absolutely committed to make sure this doesn’t re-occur.”

Edison and refinery officials have not discussed whether Edison might pay for any losses the refinery suffered from the shutdown, Grigaux said.

The refinery, which PBF bought from Exxon Mobil in July, also was briefly shut down last month following a power outage affecting more than 57,000 SoCal Edison customers.