Disentangling how communities of soil organisms are deterministically structured by abiotic and biotic factors is of utmost relevance, and few data sets on co-occurrence patterns exist in soil ecology compared to other disciplines. In this study, we assessed species spatial co-occurrence and niche overlap together with the heterogeneity of selected soil properties in a gallery forest (GF) of the Colombian Llanos. We used null-model analysis to test for non-random patterns of species co-occurrence and body size in assemblages of earthworms and whether the pattern observed was the result of environmental heterogeneity or biotic processes structuring the community at small scales by means of co-inertia analysis (CoIA). The results showed that earthworm species co-occurred more frequently than expected by chance at short distances, and CoIA highlighted a significant specific relationship between earthworm species and soil variables. The effect of soil environmental heterogeneity on one litter-feeding species but also the impact of soil-feeding species on soil physical properties was revealed. Correlogram analysis on the first axis extracted in the CoIA showed the scale of the common structure shared by the fauna and soil variable tables. The earthworm community was not deterministically structured by competition and co-occurrence of competing species was facilitated by soil environmental heterogeneity at small scales in the GF. Our results agreed with the coexistence aggregation model which suggests that spatial aggregation of competitors at patchily distributed resources (environment) can facilitate species coexistence.