Coral larvae and fish fry can detect the difference between good and bad reefs, according to a study based in Fiji.
When offered a choice of two water samples in the lab, the animals preferred the water taken from an area containing healthy corals over a seaweed populated area.
It is the first time that corals have been shown to react over long distances to chemical "smells" in the water.
The findings suggest that controlling seaweed is key to re-populating reefs.
The research by senior author, Professor Mark Hay was based on the study of three marine protected areas off the coast of Fiji that contain very healthy coral reefs but are immediately adjacent to heavily fished areas, dominated by seaweed.
"We've got these fished and un-fished areas that are small and immediately adjacent to each other, so it's a nice experimental setting," said Professor Hay.
Water from both healthy coral-filled areas and seaweed-infested locations were taken to Prof Hay's lab, where fish placed in a special chamber were offered a choice between the two.
Very young fish from 15 species all chose the water from the healthy coral reefs, spending more than 80% of their time on that side of the chamber.
"Doing the same sort of test with coral was a ground-breaking experiment", Prof Hay said.
The researchers also identified the key ingredients, by mixing things up: if they contaminated water from a healthy reef with the smell of specific seaweeds, the fish would avoid it just as much as water from an abandoned reef.
Similarly, the aroma of certain healthy corals is enough to make "bad" water attractive.
These results reveal new complexity in the way that corals behave.
Previous work had showed that coral larvae would settle in some places and not others, based on molecular cues. But researchers had only seen this happen over very short distances, when the coral effectively contacts a good or bad surface.
"This is the first time that we've seen coral's ability to assess this on a large scale, when they're floating around," Prof Hay said.
"They can't do much against a current. So what we think is going on is that they're drifting through these different reefs, and if it smells good, they go down.
If the seaweed giving off bad smells can be removed, and a previously abandoned area seeded with the most pleasantly perfumed coral, these new insights could help turn things around.
Tackling the seaweed is an important first step, and Prof Hay is working with villagers in Fiji on two strategies.
Certain fish eat the seaweed, so the locals are encouraged to avoid those species when spearfishing. There is also the potential of recruiting villagers to clear the seaweed away in the months prior to when the coral larvae are looking to settle.
Prof Steve Widdicombe, head of science in Marine Life Support Systems at the Plymouth Marine Laboratory, said the findings had important implications.
"Having the right conditions is important. [These animals] are programmed to look for the places that they're going to be most successful in.
"It was very interesting to see this idea that if we're going to bring these habitats back, just leaving them alone might not be enough. We might have to make some active steps."