Abstract Root-knot nematode (RKN) is a global menace to agricultural crop production. The role of root-associated microbes (RAMs) in plant protection against RKN infection remains unclear. Here we observed that cucumber (highly susceptible to Meloidogyne incognita) exhibited a consistently lower susceptibility to M. incognita in the presence of native RAMs in three distinct soils. Nematode infection altered assembly of bacterial RAMs along the life cycle of M. incognita. Particularly, loss of bacterial diversity of RAMs exacerbated plant susceptibility to M. incognita. A diverse range of native bacterial strains isolated from M. incognita-infected roots had nematode-antagonistic activity. Increasing the number of native bacterial strains caused decreasing nematode infection, which was lowest when six or more bacterial strains were present. Multiple simplified synthetic communities consisting of six bacterial strains showed pronounced inhibitory effects on M. incognita infection in plants. These inhibitory effects were underpinned via multiple mechanisms including direct inhibition of infection, secretion of anti-nematode substances, and regulation of plant defense responses. This study highlights the role of native bacterial RAMs in plant resistance against RKNs and provides new insight into the development of a sustainable way to protect susceptible plants.