Interactions between gene flow, spatially variable selection, and genetic drift have long been a central focus of evolutionary research. In contrast, only recently has the potential importance of interactions between these factors for coevolutionary dynamics and the emergence of parasite local adaptation been realized. Here we study host-parasite coevolution in a metapopulation model when both the biotic and the abiotic components of the environment vary in space. We provide a general expression for parasite local adaptation that allows local adaptation to be partitioned into the contributions of spatial covariances between host and parasite genotype frequencies within and between habitats. This partitioning clarifies how relative rates of gene flow, spatially variable patterns of selection, and genetic drift interact to shape parasite local adaptation. Specifically, by using this expression in conjunction with coevolutionary models, we show that genetic drift can dramatically increase the level of parasite local adaptation under some models of specificity. We also show that the effect of migration on parasite local adaptation depends on the geographic mosaic of selection. We discuss how these predictions could be tested empirically or experimentally using microbial systems.