A plume of thick black smoke could be seen many miles away and explosions were heard.
No injuries were reported, but officials are urging people from the nearby town of Casselton – some 2,300 people – to evacuate as a precaution.
An investigation into the incident has been launched.
A spokeswoman for the North Dakota Department of Emergency Services said the last 50 wagons of the train had been uncoupled, but another 56 remained at risk.
The derailment, after a collision involving another goods train, is reported to have happened near an ethanol plant.
Emergency and fire-fighting crews have been sent to the scene.
Cass County sheriff’s office said it was “strongly recommending” that residents in parts of Casselton and anyone living five miles to the south and east evacuate.
Officials have said a change in weather patterns could expose residents to smoke and possible health hazards.
Residents within 10 miles of the scene are being asked to stay indoors.
A shelter for those evacuated has been set up in Fargo, about 25 miles away.
Correspondents say it is the latest in a string of incidents that have raised alarm about a rise in crude oil traffic on the railways.
In July, a train carrying oil from the Bakken oil region in North Dakota derailed near the Canadian town of Lac Megantic, killing more than 40 people.
EFUAxRxeDuAImage source: Wikimedia Commons President-elect Donald Trump celebrated his election victory at the Ultimate Fighting…
Millions of voters across the US chose to return Donald Trump to the White House…
Donald Trump declares victory in the US election as he addresses jubilant supporters in Florida.…
Stocks around the world are rising as Donald Trump appears to be on the cusp…
Donald Trump has won Pennsylvania, North Carolina and Georgia and taken a lead over Kamala…
Quincy Jones, the celebrated musician and producer who worked with Michael Jackson, Frank Sinatra, Ray…