Researchers said they used a new approach which harnesses a bacterial protein to trigger an immune system attack on cocaine if it enters the body.
This response could dull cocaine's psychotropic effects, researchers said.
Although vaccines are normally associated with fighting bacterial or viral infections, they can also be designed to recruit the body's immune system to recognise non-microbial substances such as drugs, researchers said.
In a study published in the ACS journal Molecular Pharmaceutics, researchers took a safe bacterial protein called flagellin that has already been incorporated in other vaccines and modified it to boost the immune response to cocaine.