How large ecosystems can create and maintain the remarkable biodiversity we see in nature is probably one of the biggest open question in science, attracting attention from different fields, from Theoretical Ecology to Mathematics and Physics. In this context, modeling the stable coexistence of different species competing for limited resources is a particularly demanding task. From the 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 densities neutrally cycling without converging to a stable equilibrium and, although in recent years several mechanisms have been proposed, models able to explain the robust persistence of competitive ecosystems are lacking. Here we show that stable coexistence in large communities can be achieved when the locality of interactions is taken into account. We consider a simplified ecosystem where individuals of each species lay on a spatial network and interactions are possible only between nodes at a certain distance. Varying such distance allows to interpolate between local and global competition. Our results demonstrate that when two conditions are met: individuals are embedded in space and can only interact with other individuals within a short distance, species coexist reaching a stable equilibrium. On the contrary, when one of these ingredients is missing large fluctuations and neutral cycles emerge.