The bacterial pathogen Helicobacter pylori has co-evolved with humans and colonizes approximately 50% of the human population, but only causes overt gastric disease in a subset of infected hosts. In this Review, we discuss the pathogenesis of H. pylori and the mechanisms it uses to promote persistent colonization of the gastric mucosa, with a focus on recent insights into the role of the virulence factors vacuolating cytotoxin (VacA), cytotoxin-associated gene A (CagA) and CagL. We also describe the immunobiology of H. pylori infection and highlight how this bacterium manipulates the innate and adaptive immune systems of the host to promote its own persistence.