Five train carriages carrying hazardous petroleum products have derailed on a broken bridge over a swollen river in Canada.

The derailment on the Bow River in Calgary has left the train perching perilously close to the water as emergency crews rushed to prevent a spill.

The carriages contain petroleum distillate, a flammable light oil product that is used in paint and polishes.

It can also be mixed with the sludgy crude from the Canadian oil sands so the crude can flow in pipelines.

The tanker carriages left the tracks but remained upright and were not leaking, operator Canadian Pacific Railway said.

The Bow, one of two rivers flowing through Calgary, Canada's oil capital, reached record levels in devastating weekend floods that swamped many neighbourhoods and likely caused billions of dollars worth of damage.

The river is still flowing at three times the normal rate, but officials said it was too early to say if the floods were the reason the railway bridge failed.

A spokesman for Calgary’s fire department said part of bridge sank two feet toward the river after the accident, but had stopped sagging.

The Bow River supplies drinking water to many communities and cities downstream of Calgary.

A Canadian Pacific spokesman said the bridge, which reopened on Monday after being closed during the flooding, had been inspected by a qualified CP inspector on Saturday and the tracks had been inspected on Monday.

A follow-up inspection had been scheduled for today.

The derailed carriages were in a train of 102 carraiges.

Calgary's emergency services group said it plans to bring in pipes and other train carriages to offload the petroleum products, and then use a crane to lift the derailed train off the bridge.

The accident triggered another round of road closures in Calgary, where most of Canada's biggest oil and gas companies are based, and authorities enforced a half mile evacuation zone around the bridge.

Transport in the city of 1.1 million people had barely got back to normal after the floods, which also affected other communities across southern Alberta.