The European Food Safety Authority has recently listed Q fever as a priority for setting up a coordinated surveillance system. Although Spain is the country with the highest human incidence of the disease in the European Union, updated data on Coxiella burnetii in ruminants are still limited. A total of 780 serum samples from small ruminants and 605 sera from wild ruminants were collected in the Mediterranean ecosystems of southern Spain during the period 2015–2023. Anti-C. burnetii antibodies were detected using a commercial indirect ELISA. The overall individual seroprevalence in the small ruminants was 49.1% (383/780; 95% CI: 45.6–52.6). Antibodies against C. burnetii were identified in 40.0% (156/390) of sheep and in 58.2% (227/390) of goats. At least one seropositive animal was observed in all sheep (100%) and in 92.3% of goat flocks. The species (goat) and the existence of reproductive disorders in primiparous females were potential risk factors for C. burnetii exposure in small ruminant farms. In the wild ruminants, the overall seroprevalence against C. burnetii was 1.5% (9/605; 95% CI: 0.8–2.8). Anti-C. burnetii antibodies were found in 1.8% (2/110) of mouflon, 1.5% (6/390) of red deer, and 1.0% (1/105) of Iberian ibex. The high exposure of the small ruminants to C. burnetii, particularly in goats, detected in the present study is of animal and public health concern. Our results denote that wild ruminants only play a minor role in the epidemiology of this bacterium in southern Spain and suggest an independent epidemiological cycle of C. burnetii in domestic and wild ruminant species in the study area.