Mahy's books, stories and contributions to the New Zealand School Journal had been part of children's lives for generations, Mr Key said.
"She is widely acknowledged as one of this country's finest authors, and one of the world's greatest writers of children's and young adults' stories.
"Ms Mahy's stories resonated with children around the globe - her works were translated into a number of languages, and the accolades she received internationally illustrate her enormous contribution to children's literature."
Mr Key said Mahy's work would endure.
"I would like to extend my condolences to Ms Mahy's family and friends at this sad time.
"I am sure her stories will remain firm favourites among children here and overseas for years to come."
Children's author Jack Lasenby, who met Mahy in the early 1950s while at Auckland University studying English, told Radio New Zealand she had the "most powerful imagination of our time".
"It's that wonderful combination of reality and fantasy, a wild imagination - but a truthful one in a sense, grounded in the daily, the exact."
Lasenby said Mahy had a "remarkable span of ability", as she could write for all levels of reading ability.
"She just constantly dazzled as with her ability to turn from one group to another. I love the period of her great teenage and intermediate age novels, which are really a delightful for adults as well.
"The last few weeks, with her illness, I've been looking over some of books again and they stand up again, so fresh and delightful.
He said dressing up was "a part of Margaret", and she "enjoyed it hugely".
"I don't go in for all that silly nonsense, being a straight joker, but to Margaret, that was part of the whole business."
Mahy was also looking forward to her next book, and writing was a "compulsion", Lasenby said.
"The last time I spoke to her a couple of weeks ago on the phone she asked what I was writing, and just said rather sadly 'I'm unable to write at the moment'. That must've been a difficulty to confront."
Book blogger Graham Beattie called Mahy one of the country's greatest writers - "up there" with Katherine Mansfield.
"Farewell, Margaret, I salute you, it has been both an honour and privilege to know you," he wrote in an online tribute.
Mahy was born in Whakatane in 1936 and wrote her first story, Harry Is Bad, at the age of 7.
She studied at Auckland University College from 1952 to 1954 and Canterbury University College, graduating with a bachelor of arts degree in 1955.
A solo mother of two, Mahy trained at the New Zealand Library School in Wellington so she could work as a librarian on Banks Peninsula. She worked during the day and wrote her stories at night.
Mahy's first book to be published, in 1969, was A Lion in the Meadow, which was discovered by American editor Sarah Chockla Gross, who published five of Mahy's stories as picture books, launching her international career.
"It was one of those romantic things that happen," Mahy said of her own discovery.
In 1980, Mahy became a fulltime writer and went on to win numerous awards and honours for her contribution to NZ and children's literature.
She was appointed to the Order of New Zealand in 1993, and was made an honorary doctor of letters by the University of Canterbury.
She also won many of the world's premier children's book awards, including the Carnegie Medal and the prestigious Hans Christian Andersen Award.
Mahy continued to collect accolades as she added more books to her list of work, the most recent being the New Zealand Post Children's Book of the Year award in 2011, for The Moon and Farmer McPhee.
Mahy was known as a generous and humble person - she often visited schools and libraries, sometimes in fancy dress, thrilling children.
Watch the Made in New Zealand documentary on the life of Margaret Mahy: