The 105th Regiment Royal Artillery fired 41 rounds - one every minute - from midday at the Castle.
It also saluted the late Duke at Hillsborough Castle, Belfast, while the Honourable Artillery Company fired a salute at the Tower of London, and the 104th Regiment Royal Artillery fired from Cardiff Castle.
Similar ceremonies were also held in Gibraltar, and onboard Royal Navy warships at sea.
Ships that took part included the HMS Diamond, HMS Montrose and HMNB Portsmouth.
Dozens of Edinburgh residents watched the gun salute at the Castle from Princes Street Gardens.
They have been fired to mark significant national events since as early as at least the 18th century, and were used to mark the deaths of Queen Victoria in 1901 and Winston Churchill in 1965.
First Sea Lord and Chief of the Naval Staff Admiral Sir Tony Radakin, the most senior officer in the Royal Navy, paid tribute to the Duke of Edinburgh.
In a statement released on Saturday morning, he said: “His genuine empathy, affection and engagement with the Royal Navy resonated with us all.
“His generous spirit, his delight in all aspects of the Naval Service, and his deep understanding of our values, standards and ethos made him such a close friend to the Service for over eight decades.”
Philip joined the Royal Navy after leaving school, beginning at the Britannia Royal Naval College in Dartmouth in May 1939, and was singled out as best cadet.
During the Second World War, he served on several ships – firstly on HMS Ramillies – and saw active service against German, Italian and Japanese forces.
In March 1941, he was a searchlight control officer on the battleship HMS Valiant and was mentioned in despatches for his part in the battle of Matapan against the Italian fleet.
Shortly afterwards, he was awarded the Greek War Cross of Valour.
But the Duke stepped down from his active role in the forces to fulfil his duty as the Queen’s consort.
In recognition of his long-standing connection with the Royal Navy, the Queen conferred the title of Lord High Admiral on the Duke to mark his 90th birthday in June 2011.