About 100 passengers were trapped on a train in wild weather for nearly 17 hours in northern New South Wales.

The Countrylink XPT service from Sydney to Casino was interrupted overnight at Coramba, about 10 kilometres north of Coffs Harbour, by fallen trees on the railway line.

Railway workers removed the blockage, but the train encountered floodwater about 30 kilometres north near Glenreagh.

As it reversed back to Coffs Harbour it was stopped for a third time by a landslide.

The site was too remote for buses to reach.

An excavator eventually cleared the debris and weary travellers arrived in Coffs Harbour just before midday today (AEDT).

Some passengers say trees fell on three carriages scaring occupants inside.

A large number of small children and elderly people were onboard the train.

Passengers have praised the crew for keeping spirits high by providing complimentary food and regular updates.

However some say they received mixed messages and the food eventually ran out.