Cyclic GMP-AMP (cGAMP) synthase (cGAS) stimulator of interferon genes (STING) senses pathogen-derived or abnormal self-DNA in the cytosol and triggers an innate immune defense against microbial infection and cancer. STING agonists induce both innate and adaptive immune responses and are a new class of cancer immunotherapy agents tested in multiple clinical trials. However, STING is commonly silenced in cancer cells via unclear mechanisms, limiting the application of these agonists. Here, we report that the expression of STING is epigenetically suppressed by the histone H3K4 lysine demethylases KDM5B and KDM5C and is activated by the opposing H3K4 methyltransferases. The induction of STING expression by KDM5 blockade triggered a robust interferon response in a cytosolic DNA-dependent manner in breast cancer cells. This response resulted in resistance to infection by DNA and RNA viruses. In human tumors, KDM5B expression is inversely associated with STING expression in multiple cancer types, with the level of intratumoral CD8+ T cells, and with patient survival in cancers with a high level of cytosolic DNA, such as human papilloma virus (HPV)-positive head and neck cancer. These results demonstrate a novel epigenetic regulatory pathway of immune response and suggest that KDM5 demethylases are potential targets for antipathogen treatment and anticancer immunotherapy.