One of only three British royals in recent history to graduate from university, the 23-year-old prince earned a Scottish master's degree, the equivalent of a U.S. bachelor's degree, in geography after four years of study.
He achieved the second-highest honors, surpassing the performance of his father and uncle, Prince Edward, who received lesser honors at Cambridge University.
Dressed in a black silk graduation robe, William knelt before the university chancellor and was tapped on the head with a cap. University tradition has it that the cap contains fabric from pants worn by the Scottish religious reformer John Knox.
"Today is a very special day for me, and I am delighted that I can share it with my family, and in particular with my grandmother, who has made such an effort to come, having been under the weather," William said.
Prince William's stepmother, the duchess of Cornwall, was among the hundreds gathered to watch the four-hour ceremony in which 260 students graduated, including the prince's girlfriend, Kate Middleton.
The prince thanked the local community for allowing him privacy during his time at St. Andrews: "I have been able to lead as 'normal' a student life as I could have hoped for, and I am very grateful."
Prince William's graduation marks the end of an agreement among the British media to avoid intruding into his private life while he was a student. That arrangement was reached after his mother, Princess Diana, died in a car crash in 1997 after being chased by paparazzi.
In the fall, he will work for a time at a financial institution in London, learn about land management on a country estate and help with a mountain rescue team.
Prince William has said he wants to attend the Royal Military Academy Sandhurst, where his younger brother, Harry, enrolled last month.
The Los Angeles Times is a Tribune Publishing newspaper.