Deep inside the Waitomo cave in New Zealand is a bright spectacle. A glowing galaxy of blue stars on the black cave walls dazzles the eyes.

But these aren't stars. The lights are the glow of bioluminescent worms, the larvae of a species of gnat that has been named Arachnocampa luminosa, or “glowing spider-worm”, thanks to the beauty and hunting strategy of these glow worms. Commonly, these worms are simply called New Zealand glowworms.

After hatching from an egg, the worms cling to the walls of the cave and hang strands of sticky spit around themselves. The strands are beaded with balls of mucus, which help to magnify the worm's glow even more. They then use their bioluminescence as a lure for flying insects.

Moths and other insects use the stars and moon to navigate. But when they try to orient their flight to the "stars" in the cave, they easily become disoriented and fly into the traps.

Once the insects are snared, the worms let them tire themselves out in their struggle before hauling in the strand and devouring the insect.

Amazingly, these colonies of worms seem to dim and brighten based on a 24-hour cycle, and seem to glow in sync as a group. What scientists now wonder is just what makes them decide when and how brightly to glow. But one thing is certain: they glow brighter when they're hungry.

KQED Science explains, "Bioluminescence serves many purposes in nature, but using light to attract prey is relatively rare, especially on land. The Waitomo glow worm species is endemic to New Zealand, occurring in a number of limestone cave systems throughout the country. Related species occupy similar habitats in Tasmania and on Australia’s east coast."

Check out the video showing just how these stealthy hunters work:

These glowing worms are found in other caves in New Zealand, but Waitomo is the most famous. And the sight of countless glowing lights in a dark cave is something that lures in not only insects but people. Boat tours at Waitomo cave are a popular tourist activity and hundreds of people float into the cave each day to see the spectacle.

Jaymi Heimbuch ( @jaymiheimbuch ) focuses on wildlife conservation and animal news from her home base in San Francisco.