The 36-carriage train derailed by the station in Ludvika, Dalarna, bringing train traffic to a stop as ten of its carriages covered lay over five tracks.
"It's a long freight train and one of the carriages was on fire, with ten-metre high flames. The fire seems to have extinguished itself," Peter Persson, a local police officer who was on duty at the time, told TT.
"It will take a long time to clean up, according to the information I have. There is no other effect on traffic in the area," Persson said.
The alarm was raised shortly before 2.30 am, and it is still unclear what caused the derailment.
The train driver was not injured and has spoken to police, though he is not suspected of any wrongdoing. He told police that the train "bounced" and that it was a light on board the train which caught fire.
For the moment, there is no sign that any of the dangerous goods leaked from the train.
The accident has caused disruption to traffic between Borlänge and Hallsberg, Borlänge and Kil, and Västerås and Ludvika in both directions, according to the Swedish Transport Administration. There is no information regarding when traffic in the area will return to normal.
"Contact lines have been damaged and there's a derailment, so it could take a long time. I don't have a specific forecast, but it's a matter of days and maybe weeks," said Per Aronsson from the Transport Administration.
Trains have been replaced by buses on the affected routes.