Unlike well-known global patterns of plant species richness along altitudinal gradients, in the mountainous areas of the Brazilian Caatinga, species richness and diversity reach their maxima near mountain tops. The causes of this unusual pattern are not well understood, and in particular the role of edaphic factors on plant community assembly along these gradients has not been investigated. Our goal was to assess the role of edaphic factors (fertility and soil texture) on plant community composition and structure on two mountains of the Brazilian semi-arid region. In 71 plots (Bodocongó site, twenty-one 200-m2 plots, 401–680 m asl; Arara site, fifty 100-m2 plots, 487–660 m asl) we recorded 3114 individuals representing 61 plant species; in addition, at each plot we collected composite soil samples from 0–20 cm depth. Significant altitude-related changes were observed both for community structure and composition, and edaphic variables. A canonical correspondence analysis allowed the distinction of two groups of plots according to species abundances, indicating a preferential habitat distribution of species depending both on altitude and soil variables. Although soil fertility was lowest at the highest altitudes, these areas had high richness and diversity. Conversely, the more fertile foothills were characterized by the dominance of generalist pioneer species. Despite the relatively short altitudinal range that characterizes the studied mountains, this study elucidates the role of edaphic factors on the floristic composition and species richness patterns on the mountains of the Brazilian semi-arid region.