On dark nights in forests around the world, it’s possible to spot mushrooms giving off an eerie green light. Recently, a team of scientists from Russia, Brazil, and Japan figured out how these mushrooms glow. They use chemical reactions similar to those that light up bioluminescent animals, like fireflies and squid.

“Many creatures on Earth emit light,” says Cassius Stevani, a biochemist at the University of São Paulo in Brazil. Most bioluminescent organisms, including mushrooms, create light by producing a chemical called luciferin that reacts with oxygen (O). The two bond together with the help of a chemical called luciferase. It acts as a catalyst to speed up the reaction.

Other recent studies have helped scientists understand why mushrooms light up. They’ve found that mushrooms likely give off light to attract insects. The bugs pick up and spread the mushroom’s spores, which fungi use to reproduce.