The annual multi-faith event celebrates the 53 Commonwealth countries, and this year featured music from former One Direction star Liam Payne.
In her message, the Queen praised the “Commonwealth connection” which makes diversity “a cause for celebration”.
Prince Charles, the Duchess of Cornwall, the Duke and Duchess of Cambridge and Prime Minister Theresa May were all at the service.
The Duke of Edinburgh, who retired from public service last year, did not attend.
The Queen, who is head of the Commonwealth, said: “Through exchanging ideas, and seeing life from other perspectives, we grow in understanding and work more collaboratively towards a common future.
“There is a very special value in the insights we gain through the Commonwealth connection; shared inheritances help us overcome difference so that diversity is a cause for celebration rather than division.”
The service comes ahead of the 24th Commonwealth Heads of the Government Meeting which will be held in London in April.
Ghanaian drum collective One-Drum and spoken word artist Jaspreet Kaur were among those who performed, along with Liam Payne, who sang Waiting On The World To Change by John Mayer.