Many Gram-positive bacteria produce lantibiotics, genetically encoded and posttranslationally modified peptide antibiotics, which inhibit the growth of other Gram-positive bacteria. To protect themselves against their own lantibiotics these bacteria express a variety of immunity proteins including the LanI lipoproteins. The structural and mechanistic basis for LanI-mediated lantibiotic immunity is not yet understood. Lactococcus lactis produces the lantibiotic nisin, which is widely used as a food preservative. Its LanI protein NisI provides immunity against nisin but not against structurally very similar lantibiotics from other species such as subtilin from Bacillus subtilis. To understand the structural basis for LanI-mediated immunity and their specificity we investigated the structure of NisI. We found that NisI is a two-domain protein. Surprisingly, each of the two NisI domains has the same structure as the LanI protein from B. subtilis, SpaI, despite the lack of significant sequence homology. The two NisI domains and SpaI differ strongly in their surface properties and function. Additionally, SpaI-mediated lantibiotic immunity depends on the presence of a basic unstructured N-terminal region that tethers SpaI to the membrane. Such a region is absent from NisI. Instead, the N-terminal domain of NisI interacts with membranes but not with nisin. In contrast, the C-terminal domain specifically binds nisin and modulates the membrane affinity of the N-terminal domain. Thus, our results reveal an unexpected structural relationship between NisI and SpaI and shed light on the structural basis for LanI mediated lantibiotic immunity.