Background: Smallholder dairy production systems in low-and middle-income countries are characterised by large phenotypic variance due to diverse environmental effects, farming practices, and crossbreeding. Furthermore, small herds, low genetic connectedness, and limited data recording challenge accurate separation of environmental and genetic effect in such settings, limiting genetic improvement. Here, we evaluated the impact of modelling spatial variation between herds to address these challenges and improve the accuracy of genomic evaluation for Tanzanian smallholder dairy cattle. Results: We analysed 19,375 test-day milk yield records of 1894 dairy cows from 1386 herds across four distinct geographical regions in Tanzania. The cows had 664,822 SNP marker genotypes after quality control and were highly admixed. We fitted a series of GBLUP models to evaluate the impact of modelling the herd effect and the spatial effect on. The herd effect was fitted as an independent random effect, while the spatial effect was fitted as a random effect with Euclidean distance-based Mat ern covariance function. The models were compared based on: model fit; estimates of variance components and breeding values; correlations between the estimated contribution of breeding values, herd effect, and spatial effect to phenotype values; and the accuracy of phenotype prediction in cross-validation and forward validation. The results showed large differences in milk yield between and within regions, as well as significant variation due to the spatial effect, which were not fully captured by modelling the herd effect. The results also strongly indicate that a model with just the herd effect underestimated breeding values of animals in less favourable environments and overestimated breeding values of animals in more favourable environments. Conclusions: This study demonstrated the challenge of achieving accurate genomic evaluation in smallholder settings. By leveraging spatial modelling we maximised the use of available data and improved the separation of genetic and environmental effects. Further work is required to improve smallholder genetic evaluations by understanding environmental and genetic processes that drive the large phenotypic variance in African smallholder setting. Keywords: genomic evaluation; environmental effects; spatial effects; genetic effects; Africa