The Spanish national anthem has been played at Buckingham Palace in tribute to the victims of the Madrid bombings.
Duke of Gloucester and Spanish Ambassador Marques de Tamaron
Troops marched to the 'Marcha Real' in a revised Changing of the Guard ceremony at 1130 GMT on Sunday.
In Spain, British ambassador Stephen Wright warned the ex-pat community of the threat any potential al-Qaeda presence could cause them.
Two hundred people were killed and
1,500 injured when bombs ripped through rush-hour trains in Madrid on Thursday.
At Buckingham Palace, the Spanish Ambassador in London, the Marques de Tamaron, and the Duke of Gloucester led a one-minute silence.
Two Britons were among the injured.
The decision to play the Spanish national anthem was made by the Palace with the approval of the Queen.
An official said it was "in recognition of the tragedy which the Spanish people have suffered and to show solidarity."
The sword of honour was presented to the Marques de Tamaron and Duke of Gloucester after the anthem was played.
Crowds of people gathered outside the gates to witness the ceremony.
Spanish defence attaché Alfredo Martinez, who was there with his family, said Spaniards were touched by the Queen's gesture.
"We are very grateful to the Queen and the British people for sharing your feelings with us in this very bad moment. We are joining with friends here.
"Thanks to your country, thanks to your Queen, and thanks everybody for sharing your feelings with us," Mr Martinez said.
A similar change in protocol was made in the aftermath of the 11 September 2001 atrocities when guardsmen played the American national anthem, the Star-Spangled Banner.
In the Changing of the Guard ceremony soldiers, usually from the Queen's Household Division, march to the Palace from Wellington Barracks to take over sentry duty.
On Friday UK politicians and members of the public offered support to the Spanish people in a special mass at Westminster Cathedral. Crowds also attended a vigil at the Spanish Embassy in London's Belgrave Square.
Threat to ex-pats
In Madrid, British ambassador Mr Wright said while Basque terror group ETA was a general threat to Spanish citizens, the danger from Islamic extremists could be more so to foreigners.
He was speaking after a service at the English-speaking St George's Church.
Mr Wright said there was no specific intelligence to suggest the terrorist network posed a danger but the Madrid attacks could have implications "for all of our security".
"We will be looking again at the travel advice which the British Government puts out to British citizens."
He said authorities are still checking lists of those who died in the blasts, but added: "We are confident there are no British names among the dead who have been identified so far and they have now I think nearly all been identified."