The niche-centroid hypothesis states that populations that are distributed near the centroid of the species' ecological niche will have higher fitness-related attributes, such as population abundance and genetic diversity than populations near the edges of the niche. Empirical evidence based on abundance and, more recently, genetic diversity data support this hypothesis. However, there are few studies that test this hypothesis in coastal species, such as mangroves. Here, we focused on the black mangrove Avicennia germinans. We combined ecological, heterozygosity, and allelic richness information from 1,419 individuals distributed in 40 populations with three main goals: (1) test the relationship between distance to the niche centroid and genetic diversity, (2) determine the set of environmental variables that best explain heterozygosity and allelic richness, and (3) predict the spatial variation in genetic diversity throughout most of the species' natural geographic range. We found a strong correlation between the distance to the niche centroid and both observed heterozygosity (Ho; ρ2 = 0.67 P < 0.05) and expected heterozygosity (He; ρ2 = 0.65, P < 0.05). The niche variables that best explained geographic variation in genetic diversity were soil type and precipitation seasonality. This suggests that these environmental variables influence mangrove growth and establishment, indirectly impacting standing genetic variation. We also predicted the spatial heterozygosity of A. germinans across its natural geographic range in the Americas using regression model coefficients. They showed significant power in predicting the observed data (R2 = 0.65 for Ho; R2 = 0.60 for He), even when we considered independent data sets (R2= 0.28 for Ho; R2 = 0.25 for He). Using this approach, several genetic diversity estimates can be implemented and may take advantage of population genomics to improve genetic diversity predictions. We conclude that the level of genetic diversity in A. germinans is in agreement with expectations of the niche-centroid hypothesis, namely that the highest heterozygosity and allelic richness (the basic genetic units for adaptation) are higher at locations of high environmental suitability. This shows that this approach is a potentially powerful tool in the conservation and management of this species, including for modelling changes in the face of climate change.