Understanding the relationship between genome, phenotypic variation, and the ecological pressures that act to maintain that variation, represents a fundamental challenge in evolutionary biology. Functional polymorphisms typically segregate in spatially isolated populations [1, 2] and/or discrete ecological conditions [3-5], whereas dissecting the evolutionary processes involved in adaptive geographic variation across a continuous spatial distribution is much more challenging [6]. Additionally, pleiotropic interactions between genes and phenotype often complicate the identification of specific genotype-phenotype links [7-8], and thus of the selective pressures acting on them. Animal venoms are ideal systems to overcome these constraints: they are complex and variable, yet easily quantifiable molecular phenotypes with a clear function and a direct link to both genome and fitness [9]. Here, we use dense and widespread population-level sampling of the Mohave rattlesnake, Crotalus scutulatus, and show that genomic structural variation at multiple loci underlies extreme geographic variation in venom composition, which is maintained despite extensive gene flow. Unexpectedly, selection for diet does not explain venom variation, contrary to the dominant paradigm of venom evolution, and neither does neutral population structure caused by past vicariance. Instead, different toxin genes correlate with distinct environmental factors, suggesting that divergent selective pressures can act on individual loci independently of their genomic proximity or co-expression patterns. Local-scale spatial heterogeneity thus appears to maintain a remarkably ancient complex of molecular phenotypes, which have been retained in populations that diverged more than 1.5-2 MYA, representing an exceptional case of long-term structural polymorphism. These results emphasize how the interplay between genomic architecture and spatial heterogeneity in selective pressures may facilitate the retention of functional polymorphisms of an adaptive phenotype.