The test singles out patients likely to relapse after surgery or radiotherapy by looking for specific genetic changes at 100 sites in DNA.
Researchers believe the "genetic signature" test will help doctors determine which patients need extra help after initial treatment.
"Men who fail treatment within two years may be at the highest risk of dying from their prostate cancer," said lead scientist Professor Robert Bristow, from the University of Toronto, Canada.
"Existing methods for identifying high risk patients are imperfect, so new tests are required that are better at predicting which patients will have their cancer recur.
"These men can then be offered additional treatments, such as chemo and hormone therapy, that will combat the prostate cancer throughout their entire body, rather than therapies solely focused on the prostate, in order to improve their chances of survival.
"This is the first report of a test using information derived from biopsy samples that can predict with close to 80% accuracy which men are at high or low risk of their prostate cancer recurring."
Story continues below the slideshow:
The scientists analysed biopsy tissue samples taken from 126 treated men with prostate cancer who were thought to be at intermediate risk of their cancer returning.
They looked at each patient's whole genetic code, or genome, searching for missing, extra, or irregular sections of DNA.
From this information they were able to identify signature patterns linked to a high or low risk of recurring cancer.
The test was used to predict outcomes for a second group of 150 patients who had their prostate tumours removed by surgery.
A secondary study by the same team found that tumours affected by hypoxia - starved of oxygen -were most associated with worse survival.
"Importantly, we found that when we combined the signature with the additional information about the tumour's oxygen content, this made the genetic test even more accurate," said Prof Bristow, who presented the results at ESTRO33, the 33rd meeting of the European Society for Radiotherapy and Oncology in Vienna, Austria.
Men with low levels of genetic changes and low hypoxia had the best outcomes, with 93% lasting five years without their cancer recurring.
Only 49% of men with high levels of genetic alterations and high hypoxia escaped a cancer recurrence for five years.
Prof Bristow said: "These results will enable us to develop a new way of personalising medicine, so that we can improve cure rates and reduce the chances of the cancer spreading to other parts of the body".
Dr Iain Frame, director of research at the charity Prostate Cancer UK, said: "Being able to distinguish aggressive cancers from those which are less so is one of many unanswered questions in prostate cancer research.
"A test which could do this would be hugely important for the 40,000 men diagnosed with the disease every year. For this reason Prostate Cancer UK has made this area a key part of its research strategy.
"This new research is interesting because it suggests that looking at the DNA from individual tumours as well as the surrounding environment could tell us early on whether a cancer is going to develop in to one of the more harmful forms.
"It's too early to tell for sure whether this method could help differentiate the tigers from the pussy cats but if further research shows that it can then it could help to ensure men are offered the best possible treatment options for their individual situation and ultimately improve outcomes."