A large number of trees have been planted in built-up areas to improve the urban environment, but the effects of tree cover on spontaneous understory herbs are not yet well understood. This study surveyed spontaneous herbs in two kinds of habitats (habitats with and without tree cover) in the built-up area of the small city Junlian in Sichuan Province, China. A total of 222 species of spontaneous herbaceous plants in 180 genera of 71 families were recorded, including a vulnerable species and six species endemic to China. Although the overall species richness values were similar in the two kinds of habitat, the average species richness per quadrat of all plants, perennials, plants with the dwarf growth form, and animal-dispersed plants was significantly higher in the habitats with tree cover than in those without tree cover. The overall species association was significantly positive in the habitats with tree cover (VR = 1.51, p < 0.05) and neural (VR = 0.86) in the habitats without tree cover. Among the top 25 frequently recorded species in each kind of habitat, the species association of plants with the same trait combination type differed greatly in the two kinds of habitats. For the species association between annuals, only 13.33% of species pairs were significantly associated in the habitats with tree cover, while 22.22% of the species pairs were significantly negatively associated in the habitats without tree cover. For the species association between plants with tall growth forms, the proportion of significant positive associations in the habitats with tree cover was approximately twice than in the habitats without tree cover. For the species association between plants with the dwarf growth form, the proportion of negative associations in the habitats without tree cover was approximately twice that in the habitats with tree cover. Species with the same dispersal mode generally had a very low proportion of negative interspecific associations or a high proportion of positive interspecific associations in habitats unfavorable to their establishment. Our findings suggest that tree cover can improve the species richness of the spontaneous herbaceous species beneath them and profoundly influence interspecific coexistence relationships in a built-up area.