How large ecosystems can create and maintain the remarkable biodiversity we see in nature is probably one of the biggest open questions in science, attracting attention from different fields, from theoretical ecology to mathematics and physics. In this context, modeling the stable coexistence of species competing for limited resources is a particularly challenging task. From a mathematical point of view, coexistence in competitive dynamics can be achieved when dominance among species forms intransitive loops. However, these relationships usually lead to species’ relative abundances neutrally cycling without converging to a stable equilibrium. Although in recent years several mechanisms have been proposed, models able to explain species coexistence in competitive communities are still limited. Here we identify locality in the interactions as one of the simplest mechanisms leading to stable species coexistence. We consider a simplified ecosystem where individuals of each species lay on a spatial network and interactions are possible only between nodes within a certain distance. Varying such distance allows to interpolate between local and global competition. Our results demonstrate, within the scope of our model, that species coexist reaching a stable equilibrium when two conditions are met: individuals are embedded in space and can only interact with other individuals within a short distance. On the contrary, when one of these ingredients is missing, large oscillations and neutral cycles emerge.