Hydrogen sulfide is one of a number of potent smelly gases produced by bacteria as it breaks down food in the gut.
It is toxic in large doses but in tiny amounts it helps protect cells and fight illness, according to researchers at Exeter University.
Professor Matt Whiteman from University of Exeter's medical school said: "When cells become stressed by disease, they draw in enzymes to generate minute quantities of hydrogen sulfide.
"This keeps the mitochondria ticking over and allows cells to live. If this doesn't happen, the cells die and lose the ability to regulate survival and control inflammation.
Fellow researcher Dr. Mark Wood added: "Although hydrogen sulfide is well known as a pungent, foul-smelling gas in rotten eggs and flatulence, it is naturally produced in the body and could in fact be a healthcare hero with significant implications for future therapies for a variety of diseases."