You are not permitted to download, save or email this image. Visit image gallery to purchase the image.
However the baby Prince George was left back with the nanny for the weekly service at Crathie Kirk.
Mr Key arrived in a Royal green Range Rover with wife Bronagh, who was wearing a green silk jacket.
Their children Stephanie and Max followed, Stephanie in black and white with a smile on her face for the cameras as the cars drove through.
Another castle guest, the Queen of Norway, was also among the royal party.
Mr Key's presence was acknowledged at the service and in the notices on the back of the service sheet, which read:
"In particular we are glad to welcome, on a private visit, the Right Honourable John Key, the Prime Minister of New Zealand, along with his wife Bronagh.
The Royal family have attended the small stone church since Queen Victoria bought it in the 19th Century.
Members of the public are also allowed into the service - among them Ian Pedersen and his wife Marilyn, visitors from Queensland Australia.
Mr Pedersen said he was not a big Royalist but it was nonetheless a big thrill to be in the presence of the royals in church.
He could see the Queen, Duke, Charlie and Camilla from his pew inside.
"The highlight was just being in the presence of the Queen."
Ed Bushnell, elder of Crathie Kirk, said he had taken the Keys into the church to be seated.
"It was good to see them, I had a quick word when I showed them into their seats."
After a final lunch at the Castle, Mr Key will return to business, flying to France to meet with its President and Prime Minister.
- Claire Trevett of the New Zealand Herald, in Ballater, Scotland.