Sparks were flying off a freight train moments before a wagon derailed, partially blocking State Highway 1 in Clinton last night, a witness says.
A police spokeswoman said a rear wagon derailed about 7.30pm between Gorge Rd and Nelson St.
Dunedin man Mike Owen said he was travelling to the city from Invercargill, when he heard the roar of the train.
"The train was going past and it got louder and louder and I thought 'this is odd' and then I saw sparks coming off it high in the air and then part of it fell off the track."
There were about five cars on the road when the incident occurred and it was fortunate the wagon did not derail near traffic, he said.
"It made a real mess.
"There was a lot of coal everywhere.
"If the carriage derailed on the Balclutha side it could have damaged the closest car.
"It was just lucky it was on the other side of the road."
Part of a train track switching device was bent high in the air after the derailment, he said.
Late last night emergency services and KiwiRail staff were still working to clear the track.
A lane which had been blocked, but did not disrupt traffic flow, had been cleared, the police spokeswoman said.
No cars were involved in the incident, and no-one was hurt, she said.
A New Zealand Fire Service spokesman said appliances from Balclutha and Clinton attended the incident.