Watch: Boris Johnson's tribute to Prince Philip
Buckingham Palace announced at noon on Friday that Prince Philip "passed away peacefully this morning at Windsor Castle".
Johnson, speaking outside Downing Street shortly after the announcement, expressed his "great sadness".
The Duke, he said, "earned the affection of generations here in the United Kingdom, across the Commonwealth and around the world".
He recognised Philip's military record as one of the last surviving people in the country to have served in the Second World War.
Johnson said Philip "helped to steer the royal family and the monarchy so that it remains an institution indisputably vital to the balance and happiness of our national life".
The prime minister praised him for being an "environmentalist... long before it was fashionable", as well as his Duke of Edinburgh's Award scheme which "shaped and inspired the lives of countless young people".
Concluding his speech, he said: "We remember the Duke for all of this and above all for his steadfast support for Her Majesty The Queen.
Watch: The Duke of Edinburgh dies, aged 99
"Not just as her consort, by her side every day of her reign, but as her husband, her 'strength and stay', of more than 70 years.
"And it is to Her Majesty, and her family, that our nation’s thoughts must turn today.
"Because they have lost not just a much-loved and highly respected public figure, but a devoted husband and a proud and loving father, grandfather and, in recent years, great-grandfather.
"Speaking on their golden wedding anniversary, Her Majesty said that our country owed her husband 'a greater debt than he would ever claim or we shall ever know' and I am sure that estimate is correct.
"So we mourn today with Her Majesty The Queen, we offer our condolences to her and to all her family. And we give thanks, as a nation and a kingdom, for the extraordinary life and work of Prince Philip, Duke of Edinburgh."
World leaders' tributes
US president Joe Biden and first lady Jill Biden sent their "deepest condolences" to the Queen and royal family as they said: "The impact of his decades of devoted public service is evident in the worthy causes he lifted up as patron, in the environmental efforts he championed, in the members of the armed forces that he supported, in the young people he inspired, and so much more.
"His legacy will live on not only through his family, but in all the charitable endeavours he shaped."
Former president Barack Obama said that "through his extraordinary example", the Duke "proved that true partnership has room for both ambition and selflessness – all in service of something greater".
Recalling his first meeting with Philip, Obama said he was "kind and warm, with a sharp wit and unfailing good humour. It was our first introduction to the man behind the title, and in the years since, our admiration for him has only grown. We will miss him dearly."
French president Emmanuel Macron said Philip "lived an exemplary life defined by bravery, a sense of duty and commitment to the youth and the environment".
Russian president Vladimir Putin, conveying his condolences to the Queen, said: “Many important events in the contemporary history of your country are connected with the name of His Royal Highness. He has rightfully enjoyed the respect of the British nation as well as international recognition.”
Among the first of the world's leaders to pay tribute on Friday was Australian PM Scott Morrison, who said Philip "embodied a generation that we will never see again".
“Australians send our love and deepest condolences to Her Majesty and all the royal family," he said, adding flags will be lowered in Australia in the Duke's honour.
New Zealand PM Jacinda Ardern said Philip "will be fondly remembered for the encouragement he gave to so many young New Zealanders" through the Duke of Edinburgh’s Hillary Award over 50 years.
Canadian PM Justin Trudeau said he was a “man of great purpose and conviction” who "contributed so much to the social fabric of our country – and the world".
Narendra Modi, India's PM, praised Philip's "distinguished career in the military and was at the forefront of many community service initiatives. May his soul rest in peace."
Justin Welby, the Archbishop of Canterbury, said the Duke was an “outstanding example of Christian service”.
In a statement, he said: “On the occasions when I met him, I was always struck by his obvious joy at life, his enquiring mind and his ability to communicate to people from every background and walk of life.
“He was a master at putting people at their ease and making them feel special.
"The legacy he leaves is enormous.”
Boris Johnson's predecessor, Theresa May, said the "nation and the entire Commonwealth owe Prince Philip an extraordinary debt of gratitude for a distinguished life of service to the Queen, our country and so many around the world".
Another former PM, Tony Blair, said: "He will naturally be most recognised as a remarkable and steadfast support to the Queen over so many years. However, he should also be remembered and celebrated in his own right as a man of foresight, determination and courage."
Blair echoed Johnson's words in pointing out Philip "was often way ahead of his time in protection of the environment, in reconciliation between religious faiths, and of course in the creation of the Duke of Edinburgh’s Award".