Pharrell Williams' hat has become something of an internet phenomenon. Reuters

His feel-good track Happy dominated charts earlier this year and now Pharrell Williams has something else to smile about.

The singer/ producer, whose hits include Blurred Lines and Get Lucky, has been given the key to Virginia Beach, Virginia - his hometown.

Williams, 41, was feted at his alma mater at a ceremony held at the Princess Anne High School where he was honoured for his entrepreneurial spirit and musical achievements.

"I'm unbelievably honored to receive a key to my hometown city of Virginia Beach. Thank you VBmayor," he wrote on Twitter after the event.

Despite his success as a hip hip producer, pop star and music mogul, the father-of-one has never forgotten his roots.

He has supported a number of projects in his local community. He recently launched From One Hand to AnOTHER, a nonprofit organisation which helps at-risk youths and EverFi, an education technology company, which helps underprivileged children with an interest in maths, science and technology.

In March he raised £26,000 for From One Hand to AnOTHER after auctioning off the quirky Vivienne Westwood fedora he wore to the Grammy Awards.

"I'm giving up the Buffalo hat I wore to the Grammys to help underserved kids get the educational tools they need," Williams said at the time.