The whales were found more than 120 feet above sea level, about two-thirds of a mile from the ocean, in ancient sandstones below what is now the northbound lane of the Pan-American Highway in the Atacama region of northern Chile.

Highway construction workers found the first skeletons. They called a nearby museum, and said: We found bones.

It has turned out to be one of most extraordinary marine mammal fossil sites on the planet. Scientists discovered more than 40 skeletons, most of them baleen whales, strewn across a small area in four distinct levels, suggesting four separate mass strandings over a period of more than 10,000 years. In one spot, the skeletons of two adult whales lay on top of the skeleton of a juvenile whale.

The site includes two seals, an extinct species of sperm whale, a walrus-like toothed whale, and an aquatic sloth. Most animals were belly-up, suggesting death at sea or shortly after washing ashore, said Nick Pyenson, curator of fossil marine mammals at the Smithsonian’s National Museum of Natural History.

Pyenson is the lead author of a paper describing the assemblage of cetacean fossils, published Tuesday evening in the journal Proceedings of the Royal Society B.

The likely cause of the mass strandings were harmful algal blooms, sometimes known as red tide. That’s the only obvious mechanism that could have repeatedly wiped out a variety of animals high in the food chain, Pyenson said.

The scientists estimate the age of the rock formation, and thus of the skeletons, at 6 million to 9 million years. In the time since, the tidal cove where the whales and other animals washed ashore has been lifted high above sea level by the immense tectonic forces that also created the Andes.

The existence of whale bones in this coastal desert has been known for years, and is reflected in the name of the site: Cerro Ballena — “Whale Hill.” But when the highway expansion began in 2010, and scientists were alerted to this new cache of fossils, they were astonished at the profusion of intact, highly articulated skeletons that showed no sign of having been scavenged before they were buried and fossilized.

“I was blown away the first time I saw it. I didn’t appreciate the scale of what was described to me,” said Pyenson.

The discovery of the site has been previously reported, but the new paper, which features 14 co-authors from the U.S., Chile and Brazil, is the most comprehensive review of the fossils and their significance.

Whale fossils are usually found singularly, said Richard Norris, a paleontologist at Scripps Institution of Oceanography who was not affiliated with the new research. He said the Cerro Ballena site is an extraordinary discovery.

“Whale fossils are not common. Having articulated whale fossils is even less common,” he said. And moreover, a trove of fossils that includes animals of different ages “is vanishingly rare.”

Unfortunately, the fossils were in the path of the highway. Chile has an booming mining industry — the extraction of fossil treasure of a different sort. The bones had to be moved.

“I don’t wish a whale skeleton on anyone – it’s a logistical nightmare,” Pyenson said. “It’s a big problem just to excavate one, let alone that number.”

Pyenson enlisted a team of technicians nicknamed the “laser cowboys” to visit Chile and create a 3-D digital record of the arrangement of the skeletons. Only then were the bones excavated and shipped to museums. The 3-D data will enable the printing of replicas of the skeletons.

The digital work by Pyenson and his team is a major step forward, said Jeremy Goldbogen, a marine biologist at the Hopkins Marine Station of Stanford University who was not part of the research: “He’s really bringing paleontology into the future with these new techniques.”

Pyenson believes that the Cerro Ballena site is a paleontological treasure on par with the La Brea Tar Pits — from which the remains of mammoths and other extinct megafauna have been retrieved — and Dinosaur National Monument. He said there could be hundreds of other fossils, including many whales, still hidden in the sand and rock along the highway.