Self-incompatibility (SI) is a genetic mechanism of hermaphroditic plants to prevent inbreeding after self-pollination. Allogamous Poaceae species exhibit a unique gametophytic SI system controlled by two multi-allelic and independent loci, S and Z. Despite intense research efforts in the last decades, the genes that determine the initial recognition mechanism are yet to be identified. Here, we report the fine-mapping of the Z-locus in perennial ryegrass (Lolium perenne L.) and provide evidence that the pollen and stigma components are determined by two genes encoding DUF247 domain proteins (ZDUF247-I and ZDUF247-II) and the gene sZ, respectively. The pollen and stigma determinants are located side-by-side and were genetically linked in 10,245 individuals of two independent mapping populations segregating for Z. Moreover, they exhibited high allelic diversity as well as tissue-specific gene expression, matching expected characteristics of SI determinants known from other systems. Revisiting the S-locus using the latest high-quality whole-genome assemblies revealed a similar gene composition and structure as found for Z, supporting the hypothesis of a duplicated origin of the two-locus SI system of grasses. Ultimately, comparative genomic analyses across a wide range of self-compatible and self-incompatible Poaceae species revealed that the absence of a functional copy of at least one of the six putative SI determinants is accompanied by a self-compatible phenotype. Our study provides new insights into the origin and evolution of the unique gametophytic SI system in one of the largest and economically most important plant families.