Speciation among populations connected by gene flow is driven by adaptation to different environments, but underlying gene–environment associations remain largely unknown. Here, 162 individuals from 32 populations were sampled to obtain 191,648 independent single nucleotide polymorphisms (SNPs) across the genomes of two closely related spruce species, Picea asperata and Picea crassifolia, which occur on the Qinghai–Tibet Plateau and in surrounding regions. Using the SNP data set, genotype–environment associations and demographic modelling were used to examine local adaptation and genetic divergence between these two species. While morphologically similar, the two Picea species were genetically differentiated in multiple analyses. These species diverged despite continuous gene flow, and their initial divergence was dated back to the late Quaternary. The effective population sizes of both species have expanded since their divergence, as confirmed by niche distribution simulations. A total of 6365 genes were associated with the tested environmental variables; of these, 41 were positively selected in P. asperata and were mainly associated with temperature, while 83 were positively selected in P. crassifolia and were primarily associated with precipitation. These results deepen our understanding of the adaptive divergence and demographic histories of these two spruce species and highlight the importance of genomic data in deciphering the environmental selection underlying Quaternary interspecific divergence.