These findings, published in the journal Current Biology, suggest that the cavemen in that region were not the ancestors of the people found there today, the researchers said.
"These are the oldest partial genomes from modern human prehistory," researcher Carles Lalueza-Fox, a paleogeneticist at the Spanish National Research Council, told LiveScience.
The skeletons thought to be of two young adult males were accidentally found in 2006 by explorers in a cavern high in the Cantabrian mountain range. Winters there are notably cold, which helped preserve the DNA in the bones.
According to researchers, these bones date back to the Mesolithic period, before agriculture spread to the Iberian Peninsula with Neolithic settlers from the Middle East.
They team recovered 1.34 per cent and 0.5 per cent of the human genomes from the bones of these two cavemen, who were believed to be hunter-gatherers.
Analyses revealed that current populations of the Iberian Peninsula, which includes Spain, Portugal and Andorra, are not genetically linked with these ancientcavemen. Instead, they were closer genetically to the current populations of northern Europe.
The scientists also recovered the complete mitochondrial DNA of one of these cavemen, which suggest that Europeans during the Mesolithic were very uniform genetically.
"Despite their geographical distance, individuals from the regions corresponding to the current England, Germany, Lithuania, Poland and Spain shared the same mitochondrial lineage," Lalueza-Fox said. "These hunters-gatherers shared nomadic habits and had a common origin."
Scientists have already sequenced the genomes of our closest relatives, the Neanderthals and the Denisovans. When it came to our lineage, the oldest modern human genomes recovered yet came from Otzi the Iceman, a 5,300-year-old mummy found in the Alps in 1991.
Researchers have also salvaged DNA from even older human cells, but this comes from the mitochondria that generate energy for our bodies, and not from the nucleus where our chromosomes are housed.
The team now aims to complete the genomes of both cavemen. Such data could help "explore genes that have been modified with the arrival of the Neolithic in the European populations," Lalueza-Fox said.