Moko is well known locally for playing with swimmers in the bay
Conservation officer Malcolm Smith told the BBC that he and a group of other people had tried in vain for an hour and a half to get the whales to sea.
The pygmy sperm whales had repeatedly beached, and both they and the humans were tired and set to give up, he said.
But then the dolphin appeared, communicated with the whales, and led them to safety.
The bottlenose dolphin, called Moko by local residents, is well known for playing with swimmers off Mahia beach on the east coast of the North Island.
Mr Smith said he gave the dolphin a pat to say thank you
"I don't speak whale and I don't speak dolphin," Mr Smith told the BBC, "but there was obviously something that went on because the two whales changed their attitude from being quite distressed to following the dolphin quite willingly and directly along the beach and straight out to sea."
He added: "The dolphin did what we had failed to do. It was all over in a matter of minutes."
Back at play
Mr Smith said he felt fortunate to have witnessed the extraordinary event, and was delighted for the whales, as in the past he has had to put down animals which have become beached.
He said that the whales have not been seen since, but that the dolphin had returned to its usual practice of playing with swimmers in the bay.
"I shouldn't do this I know, we are meant to remain scientific," Mr Smith said, "but I actually went into the water with the dolphin and gave it a pat afterwards because she really did save the day."