The discovery opens up the possibility that potential drug users could be screened to see if they are likely to develop an addiction.
A study of 670 cocaine addicts found they were 25 per cent more likely to carry the gene variant than people who did not use the drug.
Rainer Spanagel, professor of psychopharmacology at the Central Institute of Mental Health in Mannheim, Germany, who led the study, said: "If you are a carrier of this gene variant the likelihood of getting addicted to cocaine is higher. You can certainly use this as a vulnerability marker for cocaine addiction."
The "cocaine gene" is a variant of the CAMK4 gene and was identified after an initial study on mice.
Scientists believe cocaine addiction is as hereditary as mental health conditions including schizophrenia, and even more so than alcoholism.
Studies suggest genetic factors account for about 50 per cent of alcoholism while cocaine addiction is about 70 per cent genetic.
Professor Spanagel suggested those with the cocaine gene could receive counselling to prevent them becoming addicted.
They could also be given experimental vaccines, currently in development, which counter the addictive effects of the drug.
There are more cocaine users in Britain that anywhere else in Europe, according to the European Union's drug agency.
By Nick Allen
Last Updated: 12:54PM GMT 11 Nov 2008