The discovery is based on a small study by researchers at Johns Hopkins University in Baltimore, Maryland and was published on Wednesday in The American Journal of Psychiatry.
"We have no consistent way to predict those who are at increased risk of killing themselves," said lead author Zachary Kaminsky, an assistant professor of psychiatry and behavioral sciences at the Johns Hopkins University School of Medicine.
"With a test like ours, we may be able to stem suicide rates by identifying those people and intervening early enough to head off a catastrophe."
Such a test is years away from being widely available to the public.
For now, researchers say they have found a chemical change in a single gene, called SKA2, which is linked to how the brain responds to stress hormones.
This gene "plays a significant role in turning what might otherwise be an unremarkable reaction to the strain of everyday life into suicidal thoughts and behaviors," said the study.
Researchers found it by examining brain samples from people who had killed themselves, and found that levels of SKA2 were significantly reduced compared to healthy people.
They also tested blood samples from 325 people in a prevention study at JHU and found that changes in the gene could predict with 80 percent certainty those who were experiencing suicidal thoughts or who had attempted suicide.
Among certain groups, the accuracy of the test was even higher.
"Those with more severe risk of suicide were predicted with 90 percent accuracy," said the study.
"In the youngest data set, they were able to identify with 96 percent accuracy whether or not a participant had attempted suicide, based on blood test results."
The SKA2 gene works to inhibit negative thoughts and control impulsive actions. When there isn't enough of it, or it is altered, the brain releases abnormal levels of the stress hormone, cortisol.
Previous studies have shown that people who try to kill themselves, or who commit suicide, have an abnormal cortisol release.
Kaminsky said more research is needed to determine if a blood test could predict suicide in a larger group of people.