A statement issued by the palace just after midday spoke of the Queen's "deep sorrow" following his death at Windsor Castle on Friday morning.
The Duke of Edinburgh, who was the longest-serving consort in British history, had returned to Windsor on 16 March after a month in hospital.
Boris Johnson said he "inspired the lives of countless young people".
"It is with deep sorrow that Her Majesty The Queen announces the death of her beloved husband," the palace said.
"The Royal Family join with people around the world in mourning his loss."
Speaking at Downing Street, the prime minister said that the duke had "earned the affection of generations here in the United Kingdom, across the Commonwealth, and around the world".
Meanwhile, Justin Welby, the Archbishop of Canterbury, said he "consistently put the interests of others ahead of his own and, in so doing, provided an outstanding example of Christian service".
The flag at Buckingham Palace was lowered to half-mast and a notice was posted on the gates following the announcement of the duke's death.
Bunches of daffodils, tulips, roses and lilies were among floral tributes placed by people outside the palace, while crowds began to gather at Windsor Castle.
The BBC's royal correspondent Nicholas Witchell said it was "a moment of real national sadness" and "a moment of sadness, most particularly of course, for the Queen losing her husband of 73 years - a bigger span of years than most of us can imagine".
He said Prince Philip had made "a huge contribution to the success of the Queen's reign", describing the duke as "utterly loyal in his belief in the importance of the role that the Queen was fulfilling - and in his duty to support her".
"It was the importance of the solidity of that relationship, of their marriage, that was so crucial to the success of her reign," he added.
A bank of photographers and cameramen were lined up around the growing number of tributes at Buckingham Palace on Friday afternoon, according to BBC News reporter Marie Jackson.
Rhea Varma, from Pimlico, pulled up to the gates on her bike to lay flowers and a note saying Rest in Peace Duke.
She said: "It's just super sad. I think it might be the beginning of big change in our country. Without him, the Queen might not reign much longer."
To her, the duke was "the kind of stability that's so old-fashioned it's difficult to comprehend. He was a rock who brought integrity."
Adam Wharton-Ward, 36, also arrived to leave lilies by the palace gates. He is visiting London from his home in France but was so moved by the news, he wanted to "rally round" for the Queen's sake.
"It's so sad. He's been with her for 73 years. If it wasn't for him who knows if she would have got through it," he said.
The duke's appeal, he added, was that he was "almost normal with his gaffes".
"Now that normality has gone," he said.
The prince married Princess Elizabeth in 1947, five years before she became Queen.
In March, the duke left King Edward VII's hospital in central London after a month-long stay for treatment.
He underwent a procedure for a pre-existing heart condition at another London hospital - St Bartholomew's.
By Helena Wilkinson, BBC News Correspondent at Windsor Castle
As news of the duke's death rippled through this royal borough, people started to gather outside the gates of Windsor castle.
Locals, including a young girl, have left flower bouquets at the castle entrance.
More are being brought.
One of the cards attached to the flowers simply reads RIP Prince Philip.
Another is addressed to Her Majesty The Queen sending their deep condolences.
There is a sombre mood here in Windsor as people quietly reflect on the news of the duke's death.
It was here where he spent his last weeks after being discharged from hospital. His last days spent with his wife, the Queen.
Prince Philip and the Queen had four children, eight grandchildren and 10 great-grandchildren.
Their first son, the Prince of Wales, Prince Charles, was born in 1948, followed by his sister, the Princess Royal, Princess Anne, in 1950, the Duke of York, Prince Andrew, in 1960 and the Earl of Wessex, Prince Edward, in 1964.
Prince Philip was born on the Greek island of Corfu on 10 June 1921.
His father was Prince Andrew of Greece and Denmark, a younger son of King George I of the Hellenes.
His mother, Princess Alice, was a daughter of Prince Louis of Battenberg and a great-granddaughter of Queen Victoria.
Politicians across the UK were united in mourning following the announcement of the duke's death.
Labour leader Sir Keir Starmer said the UK had "lost an extraordinary public servant", while Scotland's First Minister Nicola Sturgeon said his "long contribution to public life in Scotland will leave a profound mark on its people".
Wales' First Minister Mark Drakeford said the duke "served the crown with selfless devotion and generosity of spirit".
Parliament will honour the duke on Monday, with the House of Commons sitting at 14:30 BST for tributes following his death.
Parties have also suspended their campaigning elections on 6 May, which will see voters head to the polls for council and mayoral positions in England, the Scottish Parliament and Welsh Parliament.
Meanwhile, Commonwealth leaders led international reaction to the duke's death.
Australian prime minister Scott Morrison tweeted that the duke "embodied a generation that we will never see again", while Canada's prime minister Justin Trudeau described Philip as a "man of great purpose and conviction".
And Indian prime minister Narendra Modi recalled Philip for his "distinguished career in the military" and work "at the forefront of many community service initiatives".
The palace said further announcements would be made "in due course".