Scientists have discovered a way to clean oil-soaked soil and make it fertile again. The technique involves heating the soil while keeping oxygen out — an age-old process known as pyrolysis — which causes the hydrocarbons and other contaminants to decompose without damaging the soil’s clays or nutrients, according to a new study in the journal Environmental Science and Technology.

Some 98 percent of oil spills occur on land, with more than 25,000 spills recorded every year in the United States. “We saw an opportunity to convert a liability, contaminated soil, into a commodity, fertile soil,” Pedro Alvarez, an environmental engineer at Rice University and co-author of the new study, said in a statement.

Alvarez and his colleagues took soil from Hearne, Texas, contaminated it in the lab with heavy crude oil, and gently heated it in a kiln. They found that heating the soil at 788 degrees Fahrenheit for 15 minutes removed 99.9 percent of petroleum hydrocarbons and 94.5 percent of polycyclic aromatic hydrocarbons. Heating the soil to higher temperatures, as much as 878 degrees F, removed more contaminants, but decreased the soil’s fertility.