The Department of Conservation (DOC) said that the pod of 49 long-finned pilot whales was found by a tour operator early in the morning on Farewell Spit, a remote beach on the South Island.
By mid-afternoon, nine of the mammals had died and more than 60 people worked to keep the survivors alive in an attempt to refloat them at high tide.
Louisa Hawkes, a spokeswoman for whale rescue group Project Jonah, said volunteers helped keep the whales cool and comfortable throughout the day by drenching them with buckets of water, keeping them upright and making sure they did not put too much pressure on their fins.
The evening high tide allowed them to refloat the whales, she said.
The whales were spread out along the beach and one of the group's first tasks was to herd them together again in a pod.
She said about 200 people, mostly volunteers, helped form a barrier as they moved the animals out to sea.
Once in deeper water, boats took over and moved back and forth in a line to prevent the whales from returning to shore.
But Ms Hawkes said that despite their efforts, the whales had not swum away into the ocean and they feared they might beach themselves again.
"It's always fantastic to see whales out in deeper water where they should be," Ms Hawkes said. "Everyone is very hopeful but also very realistic."
Conservation rangers helped coordinate the rescue effort alongside volunteers from Project Jonah, while people who lived in the area also helped out.
Farewell Spit, a sliver of sand that arches like a hook into the Tasman Sea, has been the site of previous mass strandings.
Sometimes described as a whale trap, the spit's long coastline and gently sloping beaches seem to make it difficult for whales to navigate away once they get close.
There are different theories as to why whales strand themselves - from chasing prey too far inshore, to trying to protect a sick member of the group or escaping a predator.
Four years ago, more than 650 pilot whales beached themselves on Farewell Spit in two separate mass strandings.
More than 350 died while about 300 were saved.
Pilot whales are relatively small but can grow to more than six metres (20ft) long.