Toxoplasmosis, caused by the protozoan Toxoplasma gondii, is a worldwide zoonotic disease, which affects most warm-blooded species. Besides the zoonotic relevance, toxoplasmosis is one of the major causes of reproductive disorders in small ruminants. A cross-sectional study was carried out to determine the seroprevalence, spatial distribution and risk factors associated with T. gondii infection in sheep and goats in southern Spain. During 2015–2017, a total of 1,943 small ruminants (998 sheep and 945 goats) from 127 flocks were tested for antibodies against T. gondii using the modified agglutination test (MAT, cut-off 1:25). Antibodies against T. gondii were detected in 464 of the 998 sheep (46.5 %; CI95 %: 43.4–49.6%) and 362 of the 945 goats (38.3 %; CI95 %: 35.2–41.4%) tested. The farm prevalence was 98.4 % (CI95 %: 95.4–100%) for sheep and 93.7 % (CI95 %: 87.6–99.7%) for goats. The generalized estimating equation analysis showed that presence of cats and existence of previous reproductive disorders were risk factors potentially associated with T. gondii seropositivity in small ruminants. Two statistically significant spatial clusters (P < 0.001) were identified. The seroprevalence observed in the present study indicates a widespread exposure to T. gondii in sheep and goats in southern Spain, which might have important implications for animal and public health. Management measures should be implemented in small ruminant farms in this region in order to reduce the risk of T. gondii infections, particularly in those areas identified in the spatial analysis.