A dolphin has guided two stranded whales to safety after human attempts to keep the animals off a New Zealand beach failed, a conservation official said.

"I've never heard of anything like this before, it was amazing," Conservation Department officer Malcolm Smith said.

The actions of the dolphin, known for playing with people in the water at Mahia Beach on the east coast of the North Island, probably meant the difference between life and death for the whales, he said.

Mr Smith had been working for over an hour-and-a-half to save the two pygmy sperm whales, which had repeatedly become stranded despite his attempts to push them back out to sea.

A dolphin, named Moko by locals, appeared and guided the whales to safety after apparently communicating with them, he said.

The whales, a three-metre female and her 1.5-metre male calf, were apparently confused by a sandbar just off the beach and could not find their way back to open water.

Mr Smith had been alerted at daybreak by a neighbour about the two stranded whales on Mahia Beach near his home.

"Over the next hour and a half I pushed them back out to sea two or three times and they were very reluctant to move offshore," he said.

"I was starting to get cold and wet and they were becoming tired. I was reaching the stage where I was thinking it's about time to give up here, I've done as much as I can."

In that situation, whales are often humanely killed to end their suffering.

Moko to the rescue

Mr Smith said Moko arrived on the scene and he could hear the whales and the dolphin making noises, apparently to one another.

"The whales made contact with the dolphin and she basically escorted them about 200 metres parallel with the beach to the edge of the sandbar," he said.

"Then she did a right-angle turn through quite a narrow channel and escorted them out to sea and we haven't seen those whales since.

"What the communication was I do not know, and I was not aware dolphins could communicate with pygmy sperm whales, but something happened that allowed Moko to guide those two whales to safety."

Soon after, Moko was seen playing with swimmers on Mahia Beach, one of her favourite activities since she took up residence at the beach nearly a year ago.

The two-metre bottlenose dolphin has become well known for her antics at Mahia, which include playing in the surf with swimmers, approaching boats to be patted and pushing kayaks through the water with her snout.

"She likes people with flippers on, she's attracted to them, she's attracted to kayaks and boogy boards as well, and that'll keep her occupied for some time," Mr Smith said.

Such close interaction with humans is very rare among dolphins but not unknown.

"She's become isolated from her pod obviously for one reason or another, but obviously made Mahia home just at the moment."

Mahia gets up to 30 whale strandings a year, most of which end with the whales having to be put down.

"I don't know if next time we have a whale stranding we can get her to come in again. She certainly saved the day for us and the whales this time."

- AFP