A dangerous blaze involving explosives and gas cylinders on a freight train in Victoria's north-west has caused about $1 million damage and blocked the main Adelaide-Melbourne line.

Railway personnel and fire crews risked serious injury by disconnecting the blazing carriages from the rest of the train before learning the hazardous items were on board.

Fire crews took about eight hours to control the blaze, between Stawell and Glenorchy, that started about 6.40am (AEDT) and was put out about 3pm, Country Fire Authority (CFA) operations officer Ray Mason said.

Railways personnel, backed by firefighters, used locomotives at the front and rear of three burning carriages, to pull away dozens of other freight carriages, he said.

Mr Mason said that was done before firefighters were alerted that explosives - used in the building industry - and containers of compressed helium gas were in the burning carriages.

Once the dangerous nature of the contents was revealed by an inventory, firefighters moved about 500m from the blaze and special hazardous materials firefighting equipment was brought in, he said.

The three carriages were allowed to burn out, he said.

CFA spokeswoman Siusan (Siusan) MacKenzie said the damage to the train and contents, that also included furniture, was estimated at $1 million.

Mr Mason said cranes were being used to lift the burnt-out carriages from the line, although it would be a day or longer before the track was likely to reopen.

He said the burnt carriages were made from aluminium which was fairly flammable.

Information was not immediately available on which passenger train services would be affected by the blocked line.

Later a spokeswoman for Great Southern Railways, which operates the Overlander train service between Melbourne and Adelaide, said the line was expected to be clear by tonight's services in both directions.