A fire at an oil storage facility in the San Francisco Bay Area prompted authorities to warn about 12,000 residents to stay inside with all windows and doors closed Tuesday due to hazardous particulates in the air.

The fire broke out at around 2 p.m. in two tanks at the Nustar oil and refined products storage facility in Crockett, Calif., about 30 miles northeast of San Francisco. A Contra Costa County Fire Department spokesperson said the fire had spread to a third tank, causing grassfires in the surrounding areas.

The Contra Costa Health Department announced a “hazardous materials emergency” affecting Crockett, who number about 3,100 and nearby Rodeo, population 8,700. The department urged residents to stay indoors with windows and doors sealed and to turn off heaters, air conditioners and fans.

“Cover any cracks around doors or windows with tape or damp towels," the department said. "Stay off the phone unless you need to report a life-threatening emergency at your location."

"This is a very dynamic, rapidly evolving situation," said Capt. George Laing of the Contra Costa Fire Department. He said authorities received numerous reports of explosions before the fire and the flaming tanks “are releasing chemicals that are still burning."

ALASKA WOMAN GETS 60 YEARS FOR SETTING COUCH ABLAZE WITH BOYFRIEND ON IT

Contra Costa Fire Department spokesman Steve Hill said the tanks held varying amounts of ethanol. One tank alone contained around 167,000 gallons of the flammable substance.

Approximately 200 firefighters were battling the blazes using foam on the flames and water to cool adjacent tanks to prevent them from catching fire.

Officials closed Interstate 80, one of the busiest in the Bay Area at the peak of rush hour, causing major traffic jams. The California Highway Patrol said the closure was expected to last at least until midnight.

CALIFORNIA LYFT DRIVER IS PULLED OVER SO POLICE CAN ARREST HER PASSENGER

One Rodeo resident, Gabriel Iturbe, told The Associated Press he was sitting in bumper-to-bumper traffic trying to get home to his teenage son. His son had called him to say he heard a loud explosion.

“It literally rocked the house and then soon after, he heard what sounded like a jet plane," said Iturbe, speaking from his cellphone as his car inched forward in traffic. He said he could see “thick, black smoke” and was trying to take his son to a less smoky location.

Nustar said the burning tanks accounted for less than 1 percent of their capacity.

CLICK HERE TO GET THE FOX NEWS APP

Officials said they did not immediately know the cause of the fire and whether there was any connection to a 4.5-magnitude earthquake Monday night centered in the East Bay city of Pleasant Hill, north of Oakland.

That quake caused malfunctions at two nearby oil refineries operated by Shell and Marathon oil, Randy Sawyer, Contra Costa County's chief environmental health and hazardous materials officer, told KQED News. Some equipment at the Shell refinery was temporarily affected by the quake, spokesman Ray Fisher said.

The Associated Press contributed to this report.