Ed Sheeran performed for thousands of fans in front of Buckingham Palace to mark the end of four days of Platinum Jubilee celebrations to honor Queen Elizabeth II.

The 31-year-old musician, who recently welcomed second daughter with wife Cherry Seaborn, sang his chart-topping hit "Perfect" as images of the queen's late husband, Prince Philip, flashed behind. The Duke of Edinburgh died in April 2021 at the age of 99. 

Following his song, he joined in on a rendition of "God Save The Queen" outside the Palace at the end of the pageant, where her majesty made an appearance on the balcony after days of missed events due to mobility issues.

Sheeran previously performed for the queen at her Diamond Jubilee celebrations in 2012 when Elizabeth celebrated 60 years on the throne.

Ed Sheeran performed a few songs at Buckingham Palace

Ed Sheeran performed at the Platinum Jubilee pageant on Sunday. (Leon Neal)

PRINCE WILLIAM AND KATE MIDDLETON TAKE SURPRISE TRIP TO WALES DURING PLATINUM JUBILEE

It was the first time the queen had been seen since Thursday's lighting of the Jubilee beacons, as she backed out of church services at St. Paul's Cathedral, and missed horse racing events for only the third time in history. 

The queen was joined on the balcony by Prince Charles and Camilla Parker, the Duchess of Cornwall. Grandson Prince William and wife Kate Middleton joined her majesty, in addition to their three children: Prince George, Princess Charlotte and Prince Louis. 

Queen Elizabeth II became the first British Monarch to celebrate a Platinum Jubilee earlier this year after marking 70 years of service to the people of the United Kingdom, Realms and the Commonwealth.

Sunday's pageant capped off a four-day weekend filled with events, including the Trooping the Colour military parade, Service of Thanksgiving, Epsom Derby and Saturday's Platinum Party at the Palace concert where Alicia Keys, Hans Zimmer, Queen + Adam Lambert, Nile Rodgers, Duran Duran, Andrea Bocelli, Craig David, George Ezra and Elton John gave special performances.

Ed Sheeran brought his guitar to sing songs for Platinum Jubilee

Ed Sheeran performed outside of Buckingham Palace on the final day of Platinum Jubilee for Queen Elizabeth (Karwai Tang)

British royals make balcony appearance

Britain's Queen Elizabeth, Prince William, Catherine, Duchess of Cambridge, Prince George, Princess Charlotte, Prince Louis, Prince Charles and Camilla, Duchess of Cornwall stand on a balcony during the Platinum Jubilee Pageant, marking the end of the celebrations for the Platinum Jubilee of Britain's Queen Elizabeth, in London, Britain, June 5, 2022 (Hannah McKay/Pool)

QUEEN'S PLATINUM JUBILEE WRAPS UP WITH LONDON STREET PAGEANT

The bells of Westminster Abbey rang on Sunday just as they did on Queen Elizabeth’s coronation day in 1953 as the two-hour pageant began, and rolled through Whitehall to Admiralty Arch and down The Mall to Buckingham Palace. 

Queen Elizabeth’s 18th century Gold State Coach was paraded through the streets of London featuring a hologram of the young monarch waving. 

This marks the first time in 20 years the 260-year-old carriage was removed from its display at the Royal Mews. Unlike previous events for the jubilee, the pageant is open to the public. 

Prince Charles and his wife, Camilla, mingled with crowds on Sunday at The Oval cricket ground in London for a "Big Jubilee Lunch." Millions across the country similarly sat at long tables decorated with balloons and ate picnic fare.

CLICK HERE TO SIGN UP FOR THE ENTERTAINMENT NEWSLETTER

Queen Elizabeth waves on Buckingham Palace balcony with Prince Charles during Jubilee pageant

Britain's Queen Elizabeth and Prince Charles stand on a balcony during the Platinum Jubilee Pageant, marking the end of the celebrations for the Platinum Jubilee of Britain's Queen Elizabeth, in London, Britain, June 5, 2022 (Hannah McKay)

Despite her attendance at Thursday's Trooping the Colour military parade and flypast which honored her 96th birthday, The Palace issued a release that the queen would not be in attendance on Friday's Service of Thanksgiving at St. Paul’s Cathedral.

"The Queen greatly enjoyed today’s Birthday Parade and Flypast but did experience some discomfort," the statement read.

CLICK HERE TO GET THE FOX NEWS APP

"Taking into account the journey and activity required to participate in tomorrow’s National Service of Thanksgiving at St Paul’s Cathedral, Her Majesty with great reluctance has concluded that she will not attend."

The Palace added: "The Queen is looking forward to participating in tonight’s Beacon lighting event at Windsor Castle and would like to thank all those who made today such a memorable occasion."

Following Elizabeth's announcement, a royal expert told Fox News Digital that it's "another sobering reminder that the Queen's record-shattering [70-year] reign is drawing to an end."