A New Zealand river revered by the Maori has been recognised by parliament as a "legal person", in a move believed to be a world first.

Under legislation passed on Wednesday that combines Western legal precedent with Maori mysticism, the Whanganui river has been formally declared a living entity.

"[It] will have its own legal identity with all the corresponding rights, duties and liabilities of a legal person," Attorney-General Chris Finlayson said.

"The approach of granting legal personality to a river is unique."

The river, known by Maori as Te Awa Tupua, is the third longest in New Zealand.

Finlayson said the local Maori iwi, or tribe, had been fighting to assert their rights over the river since the 1870s, in New Zealand's longest-running legal dispute.

"This legislation recognises the deep spiritual connection between the Whanganui iwi and its ancestral river," he said.

It deems the river a single living being "from the mountains to the sea, incorporating its tributaries and all its physical and metaphysical elements".

In practical terms, it means the river can be represented at legal proceedings with two lawyers protecting its interests, one from the iwi the other from the government.

The iwi also received an NZ$80m ($56m) settlement from the government after their marathon legal battle, as well as NZ$30m to improve the river's health.