The fire happened at 8 a.m. inside a substation at BART's Richmond maintenance yard.
The flames knocked out power to the entire yard, which meant the trains couldn't move.
BART officials drove train operators to the Hayward yard where the trains were working.
The Richmond to Fremont line was shut down for about 45 minutes.
Investigators are looking into the cause of the fire.