The detection of adaptive loci in the genome is essential as it gives the possibility of understanding what proportion of a genome or which genes are being shaped by natural selection. Several statistical methods have been developed which make use of molecular data to reveal genomic regions under selection. In this paper, we propose an approach to address this issue from the environmental angle, in order to complement results obtained by population genetics. We introduce a new method to detect signatures of natural selection based on the application of spatial analysis, with the contribution of geographical information systems (GIS), environmental variables and molecular data. Multiple univariate logistic regressions were carried out to test for association between allelic frequencies at marker loci and environmental variables. This spatial analysis method (SAM) is similar to current population genomics approaches since it is designed to scan hundreds of markers to assess a putative association with hundreds of environmental variables. Here, by application to studies of pine weevils and breeds of sheep we demonstrate a strong correspondence between SAM results and those obtained using population genetics approaches. Statistical signals were found that associate loci with environmental parameters, and these loci behave atypically in comparison with the theoretical distribution for neutral loci. The contribution of this new tool is not only to permit the identification of loci under selection but also to establish hypotheses about ecological factors that could exert the selection pressure responsible. In the future, such an approach may accelerate the process of hunting for functional genes at the population level.