Volcanic eruptions could now be predicted decades in advance thanks to a New Zealand study of ancient magma crystals.
A study of crystals from an eruption in New Zealand about 700 years ago found a pattern in the thermal history of magma that reveals when the next one is due.
According to the Daily Mail, the crystals are "like a black-box flight recorder" for studying volcanic eruptions, one researcher claimed.
The analysis found the magma went through a comparatively "cool" period for thousands of years before heating up.
Once temperatures reached 750C, it was decades or less until an eruption happened.
Geologist Professor Adam Kent, of Oregon State University, said: "Mobility in magma is a function of temperature and most of the time when it is sitting there in the Earth's crust under the volcano it is cool.
"Of course, cool is a relative description since it is still some 650C - I would not put my finger on it.
"But to erupt onto the Earth's surface, magma needs to heat up so it can be runny enough to be squeezed along cracks in the Earth and pushed up to the surface.
"At lower temperatures, the magma is too crystal rich and viscous to move.
"It's like trying to spread cold peanut butter onto a piece of bread.
"It takes higher temperatures to get things moving - and then our data show it's only a period of years or decades before it erupts."
The further a volcano is from erupting, the harder it is to predict. Working out if a volcano will erupt within centuries is still impossible.
Although they can't be prevented, knowing when eruptions are going to happen would make them less hazardous.
But scientists have struggled for decades to pinpoint the exact geological processes leading up to them.
One important limitation has been a lack of knowledge about the temperature history of the magma.
Kent and colleagues based their new technique on crystals of the zirconium silicate mineral in magma from the Mt Tarawera eruption about 1315.
The ash thrown from Tarawera may have affected temperatures around the globe and caused the Great Famine of 1315-17 in Europe.
The pattern of long-term crystal storage in almost solid magma, punctuated by rapid heating, was found to be applicable to many other volcanoes around the world, said the researchers.
It may help volcanologists recognise when a volcano is about to blow, according to the study, published in Science.
The key to honing in on these long-term geologic processes is understanding the volcanoes' temperature history, the researchers explained.
The crystals are like a "black box" flight recorder for studying volcanic eruptions, according to co-author Dr Kari Cooper, of the University of California.
She said: "Instead of trying to piece together what happened from the wreckage, the crystals can tell us what was going on while they were below the surface, including the run up to an eruption."