Before the dinosaur age, the coelacanth — a hefty, mysterious fish that now breathes with its gills — sported a well-developed lung, a new study finds.

This lung likely helped the fish survive in low-oxygen, shallow waters hundreds of millions of years ago, the researchers said. During the Mesozoic era, more commonly known as the dinosaur age, it's likely that some species of coelacanth (see-leh-kanth) moved to deeper waters, stopped using their lungs and began relying exclusively on their gills to breathe, the researchers said.

This adaptation to deep water likely helped coelacanths survive the asteroid that slammed into ancient Earth and killed the nonavian dinosaurs, the researchers said. The fish's gill- and lung-breathing relatives were not as lucky; during the Late Cretaceous period, about 66 million years ago, coelacanths living in shallow waters disappear from the fossil record, they said. [See Images of Modern and Fossil Coelacanths]

The hulking 6.5-foot-long fish has long baffled scientists. Fossils of the predatory fish date back to the early Devonian period, about 410 million years ago. The fish was thought to have gone extinct after the dinosaur-killing asteroid hit Earth, but living coelacanths were discovered off the coast of South Africa in 1938.

Today, there are two known species of living coelacanths that live in the deep waters near Mozambique and Indonesia. Scientists have collected and preserved entire specimens of these fish (which give birth to live young) over the decades, allowing researchers to study how the fish change from embryos to adulthood. 

In the new study, researchers examined the curious lungs of one species of coelacanth (Latimeria chalumnae) at five different stages of growth. They scanned each specimen with X-ray tomography, a method that allows researchers to take multiple X-rays of an object, compile them and create a 3D image.

"Our results demonstrate the presence of a potentially functional, well-developed lung in the earliest known coelacanth embryo," the researchers wrote in the study. However, as the embryo grows, its lung development slows, and it eventually becomes a vestigial (functionless) organ in the fish, they observed.

Interestingly, adult L. chalumnae have small, hard, flexible plates scattered around their vestigial lungs. It's possible that these plates are similar to the "calcified lung" of fossil coelacanths, said Paulo Brito, one of the study's researchers and a professor of zoology at Rio de Janeiro State University in Brazil.

"In fossil coelacanths, these plates surrounding the lung most probably had a function in lung volume regulation, moving over each other to accommodate volumetric changes," Brito told Live Science in an email. "In extant [living] coelacanths, it represents a rudimentary anatomical structure."

It's possible that the lung became less developed as the coelacanth moved to deeper waters, but remnants of it still exist as a vestigial organ, the researchers said. However, as the lung shrank and became useless, a fatty organ that the fish uses for buoyancy control in deep waters grew and took over the space once occupied by the lung.

"Although we cannot know whether the fatty organ ever existed in fossil forms, due to its unique soft-tissue constitution, this organ in Latimeria has a function in buoyancy control," the researchers said in the study.

Given that the coelacanth has evidence of "calcified lungs" in the fossil record, as well as a developing lung early in its embryonic development, it's possible that the "lung is a primitive character[istic] in bony fishes," Brito said. Lungs are also present in most ancient ray-finned fishes (a subclass of boney fishes), lungfishes and living lobe-finned fish (such as the coelacanth), as well as four-legged vertebrates, including amphibians, reptiles, mammals and birds.

The new findings were published online Sept. 15 in the journal Nature Communications.

Copyright 2015 LiveScience, a Purch company. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.