Scientists say they have made a step forward in the fight against a wheat disease that threatens food security.
Wheat is a staple food crop, making up a fifth of the calories on our plates.
But in many parts of the world, the crop is being attacked by stem rust (black rust), a fungus that can ravage a farmer's fields.
Researchers from the UK, US and Australia identified genetic clues that give insights into whether a crop will succumb to stem rust.
They discovered a gene in the fungus that triggers a wheat plant's natural defences. A second pathway has been discovered which switches on a wheat plant's immune response.
The research, reported in the journal Science, gives new tools for protecting crops from the deadly pathogen.
Stem rust has caused crop epidemics and famine for millennia.
In the 1950s, wheat rust spread through North America and destroyed up to 40% of the crop.
Since then, scientists have developed rust-resistant varieties to boost wheat's immunity to the fungus.
But the pathogen is evolving all the time.
A particularly aggressive strain recently appeared in several countries in Africa and the Middle East, with winds threatening to carry it further afield.
The new research paves the way for rapid DNA testing of suspect wheat samples to see if wheat fields need to be sprayed with pesticides.
"For the first time, it will be possible to do DNA testing to identify whether a rust in a wheat crop anywhere in the world can overcome a rust-resistance gene, called Sr50, which is being introduced in high-yielding wheat varieties," said Robert Park, Professor of Sustainable Agriculture at the University of Sydney and a researcher on the study.
"This will indicate whether or not a given wheat crop needs to be sprayed with expensive fungicide quickly to protect against rust, which would otherwise devastate the crop in a matter of weeks."
The study raises hopes that scientists can keep one step ahead of the deadly pathogen, by breeding new strains of wheat for the future.
"Now we can observe the evolution of the pathogen," said Dr Matthew Moscou of The Sainsbury Laboratory in Norwich, who is not connected with the study.
"We can predict its impact on our wheat crops. In the future, we will be able to do smart plant breeding for resistance to these diseases."
Follow Helen on Twitter.