Mild inhibition of mitochondrial respiration extends the lifespan of many species. In Caenorhabditis elegans, reactive oxygen species (ROS) promote longevity by activating hypoxia-inducible factor 1 (HIF-1) in response to reduced mitochondrial respiration. However, the physiological role and mechanism of ROS-induced longevity are poorly understood. Here, we show that a modest increase in ROS increases the immunity and lifespan of C. elegans through feedback regulation by HIF-1 and AMP-activated protein kinase (AMPK). We found that activation of AMPK as well as HIF-1 mediates the longevity response to ROS. We further showed that AMPK reduces internal levels of ROS, whereas HIF-1 amplifies the levels of internal ROS under conditions that increase ROS. Moreover, mitochondrial ROS increase resistance to various pathogenic bacteria, suggesting a possible association between immunity and long lifespan. Thus, AMPK and HIF-1 may control immunity and longevity tightly by acting as feedback regulators of ROS.