The Prime Minister said 2012 had been an "extraordinary year for our country". He added: "We cheered our Queen to the rafters with the Jubilee, showed the world what we're made of by staging the most spectacular Olympic and Paralympic Games ever and – let's not forget – punched way above our weight in the medals table."
However, he stressed we should also remember the Christmas story, which brought hope to countless millions across the world.
"The Gospel of John tells us that in this man was life and that his life was the light of all mankind and that he came with grace, truth and love. Indeed, God's word reminds us that Jesus was the Prince of Peace."
Mr Cameron added: "With that in mind, I would like to pay particular tribute to our brave servicemen and women who are overseas, helping bring safety and security to all of us at home; their families who cannot be with them over the holidays and to all the dedicated men and women in the emergency services who are working hard to support those in need.
"When we are celebrating with family and friends, they and many others are all working on our behalf and deserve our thoughts and appreciation. So, however you celebrate this time of year, it is my hope and prayer you have a happy and peaceful Christmas."
Mr Salmond urged people to think of others as he highlighted the legacy of explorer and humanitarian David Livingstone whose bicentenary falls in March.
Speaking at the Livingstone exhibition at the National Museum of Scotland, the First Minister said: "As we look to that anniversary in 2013, we can reflect on David Livingstone as exemplifying many of the best characteristics of Scotland: an internationalist outlook; an ambition to succeed; a passion for education and, perhaps most of all, a strong sense of solidarity and a deep sense of compassion.
"These values are important at any time, but especially at Christmas. As well as being a time of celebration, Christmas is a time when it is particularly important to think of others; to care about those who may be facing hardship, loneliness or illness."
Mr Salmond added: "I also want to pay a particular tribute to the many people, especially in our emergency services and our armed forces, for whom Christmas is not a holiday at all. That service is appreciated all year round, but particularly valued at Christmas time."