Philip, 90, is being treated at Papworth Hospital near Huntingdon, Cambridgeshire, following treatment for a blocked coronary artery.
Police estimated 3000 well-wishers had gathered outside St Mary Magdalene Church to see royals, including the Prince of Wales and the Duchess of Cornwall, the Duke of Cambridge, Prince Harry, the Princess Royal, the Duke of York and the Earl and Countess of Wessex.
England rugby player Mike Tindall and the Queen's granddaughter Zara Phillips, who married this year, also attended the service.
The royals traditionally gather at Sandringham for Christmas.
Philip normally walks the few hundred metres from the main house to the church and is not thought to have missed a Christmas Day service before.
Carmilla Fitt, 71, who lives near Dover, Kent, and is spending Christmas in the Sandringham area, said: "Charles said he is coming on. He is very well and in very good spirits.
"He said he is very determined.''
Prince William told well-wishers that the Duke was "very well, thank you. Getting much better.''
Buckingham Palace officials said Philip "remains in good spirits''.
A royal family spokesman said family members would visit Philip in hospital later in the day.