Mycobacterium tuberculosis (Mtb) induces necrosis of infected cells to evade immune responses. Recently, we found that Mtb uses the protein CpnT to kill human macrophages by secreting its C-terminal domain, named tuberculosis necrotizing toxin (TNT), which induces necrosis by an unknown mechanism. Here we show that TNT gains access to the cytosol of Mtb-infected macrophages, where it hydrolyzes the essential coenzyme NAD+. Expression or injection of a noncatalytic TNT mutant showed no cytotoxicity in macrophages or in zebrafish zygotes, respectively, thus demonstrating that the NAD+ glycohydrolase activity is required for TNT-induced cell death. To prevent self-poisoning, Mtb produces an immunity factor for TNT (IFT) that binds TNT and inhibits its activity. The crystal structure of the TNT–IFT complex revealed a new NAD+ glycohydrolase fold of TNT, the founding member of a toxin family widespread in pathogenic microorganisms.