The findings, published in the journal Scientific Reports, indicate prehistoric humans inhabited caves with high heavy metal levels caused from fires, fumes and ashes which could have played a role in their tolerance of environmental pollution.
The highest levels of heavy metals - copper, lead, nickel and zinc - were found in Gorham's Cave in Gibraltar, a tiny British territory on Spain's southern tip, where well preserved Neanderthal hearths have been found.
"It is the earliest known evidence of heavy metal pollution resulting from human activity," the government of Gibraltar said in a statement.
Traces of heavy metal pollution were also found in Vanguard Cave in Gibraltar from fires as well as in El Pirulejo in southern Spain linked to the use of galena, a lead sulphide used as a source of pigment or as raw material to manufacture beads, according to the study.
The scientists also found heavy metal pollution at Gran Dolina, a cave site in the Sierra de Atapuerca region of central Spain near Burgos. But they concluded that this came from bat and bird droppings and not from human activity.
They said the sites mentioned comprised "earliest evidence of pollution by heavy metals in archaeological sites" anywhere in the world.
"Despite these high pollution levels, the contaminated soils might not have posed a major threat to Homo sapiens populations," the study said.
"Altogether, the data presented here indicate a long-term exposure of Homo sapiens to these elements, via fires, fumes and their ashes, which could have played certain role in environmental-pollution tolerance, a hitherto neglected influence."