Since domestication, a large number of livestock breeds adapted to local conditions have been created by natural and artificial selection, representing one of the most powerful ways in which human groups have constructed niches to meet their need. Although many authors have described local breeds as the result of culturally and environmentally mediated processes, this study, located in mainland Spain, is the first aimed at identifying and quantifying the environmental and human contributions to the spatial structure of local breed diversity, which we refer to as livestock niche. We found that the more similar two provinces were in terms of human population, ecological characteristics, historical ties, and geographic distance, the more similar the composition of local breeds in their territories. Isolation by human population distance showed the strongest effect, followed by isolation by the environment, thus supporting the view of livestock niche as a socio-cultural product adapted to the local environment, in whose construction humans make good use of their ecological and cultural inheritances. These findings provide a useful framework to understand and to envisage the effects of climate change and globalization on local breeds and their livestock niches.