"I think it's fair to say that this will be a wee one that a village will raise, but we couldn't be more excited," she wrote.
She said although there would be "lots of questions" she and her partner had a plan all ready to go.
A baby due in June indicates she became pregnant in September - during the election campaign.
Labour's Broadcasting Minister, Clare Curran, said she and other members of the Labour caucus were told this morning of the happy news.
Within minutes of her announcement, Ardern's Facebook page was flooded with messages of congratulations.
Ardern said: "We're both really happy. We wanted a family but weren't sure it would happen for us, which has made this news unexpected but exciting.
"Yesterday I met Deputy Prime Minister, Winston Peters, to share the news and to ask him to take on the role of Acting Prime Minister for six weeks after our baby is born.
"As is the case when I am overseas, Mr Peters will act as Prime Minister, working with my office while staying in touch with me. I fully intend to be contactable and available throughout the six week period when needed."
Ardern said she planned to take a six-week break from Parliament.
Gayford would be the primary caregiver.
"At the end of my leave I will resume all Prime Ministerial duties.
"Clarke and I are privileged to be in the position where Clarke can stay home to be our primary caregiver. Knowing that so many parents juggle the care of their new babies, we consider ourselves to be very lucky."
Ardern said she learned she was pregnant on October 13 "but as many couples do in the early stages, we kept it to ourselves".
"We consider ourselves lucky for another reason. Clarke and I have always been clear we wanted to be parents but had been told we would need help for that to happen. That's made this news a fantastic surprise."
She said: "While 2018 will be the year I become a mum, it will also be a year that the Government finishes our 100-day plan, and starts pursuing all of the priorities that will build a better New Zealand. I look forward to leading that work, and having a slightly expanded family join me on that journey. "
Labour Party general secretary and election campaign manager Andrew Kirton was one of scores to tweet his congratulations to the couple.
Even opposition politicians put partisan leanings aside to offer their good wishes.
Even a government ministry took the opportunity of the Prime Minister's pregnancy to offer useful health advice.
Former Labour leader, and the man whose job she took over just weeks out from last year's election, Andrew Little today added his well wishes.
Members of the Green Party also added their best for the first family.
Green Party co-leader James Shaw said today's announcement was significant to women everywhere and showed to the world what type of country New Zealand was.
"This is wonderful news. On behalf of the Green Party, I'd like to congratulate Jacinda and Clarke, and wish them the very best for parenthood," said Shaw.
"That a woman can be the Prime Minister of New Zealand and choose to have a family while in office says a lot about the kind of country we are and that we can be – modern, progressive, inclusive, and equal."
National Party Leader Bill English has extended his warm congratulations to Jacinda Ardern and Clarke Gayford on their baby news.
"Mary and I would like to extend our sincere congratulations to Prime Minister Jacinda Ardern and her partner Clarke Gayford on the news of the Prime Minister's pregnancy.
"It is an incredible privilege to be a parent. A new child will bring real joy to their lives. We wish them all the best."
Broadcasting Minister Clare Curran said she cried when she found out. (edited)
She said Ardern had always been a role model for young girls but this "takes it to another level".
She said she "completely understands" why Ardern waited to share the news and that it was "her business".
She said they had a close-knit caucus and she expected things wouldn't change drastically.
"Women have been having babies for a long time and things still carry on.
"I don't expect it to be an issue."