The research confirms that greying with age is at least partly determined at birth.
Understanding how the IRF4 gene washes colour out of hair might lead to future therapies that halt or reverse the process, scientists believe.
The British-led team also found genes that influence hair curliness and the likelihood of growing a “monobrow”.
Researcher Dr Kaustubh Adhikari, from University College London, said: “We already know several genes involved in balding and hair colour but this is the first time a gene for greying has been identified in humans, as well as other genes influencing hair shape and density.
“It was only possible because we analysed a diverse melting pot of people, which hasn’t been done before on this scale. These findings have potential forensic and cosmetic applications as we increase our knowledge on how genes influence the way we look.”
The scientists analysed DNA samples from 6,357 people of mixed ethnic ancestry from five South American countries. Among the volunteers were individuals of European, Native American and African descent, providing a wide range of head hair types.
The IRF4 gene was already known to play a role in hair, skin and eye colour. Hair greying is caused by an absence of the pigment melanin, whose production and storage is regulated by a process involving IRF4.
Study leader Professor Andres Ruiz-Linares, also from University College London, said: “We have found the first genetic association to hair greying, which could provide a good model to understand aspects of the biology of human ageing.
“Understanding the mechanism of the IRF4 greying association could also be relevant for developing ways to delay hair greying.”
Another gene, PRSS53, was found to influence hair curliness, with one “new” variant linked to the very straight hair of people from the Far East.
Professor Desmond Tobin, from the University of Bradford, who led this part of the study, said: “The PRSS53 enzyme functions in the part of the hair follicle that shapes the growing hair fibre, and this new genetic variation, associated with straight hair in East Asians and Native Americans, supports the view that hair shape is a recent selection in the human family.”
Additional genes associated with hair included EDAR for beard thickness and hair shape, FOXL2 for eyebrow thickness, and PAX3 for monobrow prevalence.
Dr Adhikari said: “It has long been speculated that hair features could have been influenced by some form of selection, such as natural or sexual selection, and we found statistical evidence in the genome supporting that view.
“The genes we have identified are unlikely to work in isolation to cause greying or straight hair, or thick eyebrows, but have a role to play along with many other factors yet to be identified.”
The findings are reported in the journal Nature Communications.
Both men and women were assessed for hair shape, colour, balding and greying, said the scientists. But only men were tested for beard, monobrow and eyebrow thickness.