A KiwiRail spokeswoman told the Otago Daily Times two wagons had derailed after a bogey on each left the tracks.
The wagons were upright and would be lifted by a crane and placed back on the tracks, the spokeswoman said.
Dunedin KiwiRail workers attended the derailment near Pitt St last night and decided to wait until first light today to properly assess the situation.
A passing siding on the main line at Waitati meant no other freight or passenger train services would be disrupted by the derailment, the spokeswoman said.
The train driver alerted KiwiRail controllers to the derailment and Dunedin police were also contacted but were not required to investigate.
Port Otago commercial manager Peter Brown said a wagon of a container train left the rails in the tunnel leading into Port Chalmers from Dunedin on Thursday night.
It was put back on the rails before morning, when normal operations resumed, he said.
There was no damage to goods or infrastructure, Mr Brown said.