The Latest: Investigators are at the scene of the explosion and fire.

An explosion at an oil storage facility in Crockett on Tuesday afternoon sent a huge fireball into the air in west Contra Costa County, shaking buildings and rattling windows for miles around and igniting a fire that burned for hours.

Officials were investigating whether the explosion was triggered by a 4.5 quake that struck Pleasant Hill in the central part of the county 15 hours earlier.

“It is one of many things we will be looking at as we work with officials to identify the cause of the fire,” said Mary Rose Brown, a spokeswoman with NuStar Energy, the fuel-storage facility where at least one tank exploded just before 2 p.m.

The force of the blast felt like an earthquake, residents who experienced it said. Officials said all workers in the area were accounted for and safe. Minutes after the explosion, emergency sirens activated in the area and officials ordered residents in Crockett and Rodeo to shelter in place due to potentially unhealthy air contaminants.

The tiny community of Tormey, adjacent to the explosion site and home to about a dozen to 20 people, was evacuated.

“I felt a big whoosh and then a bright light and then I heard the bang,” said Tim Clark, who was driving along the Cummings Skyway when the blast occurred.

Ed Boyle, owner of Rodeo Hardware, a couple miles from the explosion site, heard a thunderous boom and his windows rattled and something fell from a shelf. “I thought it was an earthquake.”

Two tanks at NuStar Energy holding a combined 250,000 gallons of ethanol erupted in flames and one collapsed, according to Steve Hill, a spokesman for the Contra Costa County Fire Protection District. Seven hours after the explosion and fire began, the fire was contained and no longer threatening to spread to three other nearby tanks, each containing either jet fuel or ethanol.

Firefighters worked to keep the neighboring tanks cool to prevent another rupture or explosion, said Contra Costa County health officer Randy Sawyer.

The greatest risk to the community was smoke inhalation, and hazmat teams were assessing the health threats to Crocket, Rodeo and Hercules.

The blast occurred at NuStar’s facility at 90 San Pablo Avenue near Cummings Skyway in Crockett, which stores fuels and hydrocarbons, Sawyer said. Officials were still investigating the cause of the explosion.

The blaze also sparked a vegetation fire that swelled to 15 acres, which was 75% contained by Tuesday evening.

Both directions of I-80 were closed from Highway 4 in Hercules to Interstate 780 in Vallejo — and didn’t open until after 9 p.m., according to the California Highway Patrol. The closure caused a horrendous traffic jam during the evening that left commuters in standstill traffic for hours in and around Pinole.

Now Playing:

The incident drew more than 40 fire units and 200 people to the scene, including teams from Contra Costa County Fire, Crockett Fire, Cal Fire, East Bay Regional Park District and the Petrochemical Mutual Aid Organization.

The explosion occurred after a 4.5-magnitude earthquake struck near Pleasant Hill in Contra Costa on Monday night, causing flaring at two refineries in Martinez.

Flaring is a safety procedure to burn off excess gas, and it occurred at the Marathon Petroleum refinery in Martinez and at the Shell refinery in Martinez.

Shell spokesman Ray Fisher said “some equipment was temporarily affected by the quake,” but operations were back to normal Tuesday morning.

Officials could not say for certain Tuesday whether the NuStar explosion was related to the quake, but although NuStar said it was being considered, Sawyer said it was unlikely, though too early to know.

“We haven’t had something like this happen in many years,” he said.

Now Playing:

The Selby Terminal, as the facility is known, is one of many energy-storage properties run by San Antonio’s NuStar Energy. Because it stores fuel but does not produce it, the incident is not expected to cause a jump in gas prices as refinery disruptions can.

According to the company website, the facility holds 24 tanks and has a capacity of 3.04 million barrels.

John Gioia, a Contra Costa County supervisor who lives in Richmond, said: “It’s always unacceptable to have an industrial accident. This one has a risk affecting life and health in a dramatic way.”

Six of the worst The explosion and fire at the NuStar storage facility in Crockett on Tuesday was the first major incident in recent memory at a fuel storage facility in the area. All of the other major incidents have occurred at area refineries. Here are six, two of which were deadly: August 6, 2012: A series of explosions and fires tore through Chevron's Richmond refinery. While a black cloud wafted over the Bay Area during the fire at the Chevron oil refinery, more than 1,700 people ended up in emergency rooms. February 23, 1999: An explosion sent a fireball ripping through a tower at Tosco's refinery near Martinez, killing 4 and severely injuring another. January 21, 1997: A fiery explosion rocked the Tosco Refinery Co. near Martinez, killing one man and injuring 24 others. The reverberations from the blast were felt 20 miles away, with smoke and flames visible from nearby freeways. June 15, 1995: A 4.2 million-gallon naphtha tank at the Unocal San Francisco refinery in Rodeo caught fire, sending clouds of black smoke over Interstate 80 that were visible at least 15 miles away. A community alert network urged residents in Tormey and Crockett to stay indoors to avoid the smoke. September 4, 1989: Explosions that felt like major earthquakes rocked the Shell Oil refinery in Martinez, touching off an inferno that spewed a giant plume of smoke stretching for miles over the region. At least two workers were injured in the fire, which was confined to the plant area on the northeast side of town. April 9, 1989: A lunchtime explosion at the Chevron oil refinery in Richmond touched off a crude-oil fire that injured eight people and spewed a huge cloud of black smoke across the East Bay. The fire, which burned into the night, started when an as yet unexplained hydrogen leak ignited gasoline and jet fuel.

Read More

While the county’s refineries must adhere to the strict Industrial Safety Ordinance, a storage facility like NuStar does not need to follow the same safety guidelines, Gioia said.

The supervisor, who sits on the California Air Resources Board, said the county will conduct an investigation into the explosion that could result in fines, penalties and corrective actions.

The Cal EPA website shows that the NuStar facility has had five violations since 2015 but violations were addressed quickly.

Cal/OSHA said it will investigate NuStar to determine the cause of the explosion and fire and to see if there were any workplace safety violations.

Chronicle Staff Writers Suzanne Espinosa Solis, Lauren Hernández and Alejandro Serrano contributed to this report.

Megan Cassidy, Mallory Moench and Matthias Gafni are San Francisco Chronicle staff writers. Email: megan.cassidy@sfchronicle.com, Mallory.Moench@sfchronicle.com, matthias.gafni@sfchronicle.com Twitter: @meganrcassidy @mallorymoench @mgafni