Habronema microstoma and Habronema muscae (Spirurida: Habronematidae) are parasitic nematodes which infect the stomach and/or skin of equids. The accurate diagnosis of gastric habronemosis is central to studying its epidemiology, but data on its distribution and prevalence are lacking, mainly due to the limitations of clinical and coprological diagnosis in live horses. To overcome this constraint, a two-step, semi-nested PCR-based assay was validated (utilizing genetic markers in the nuclear ribosomal DNA) for the specific amplification of H. microstoma or H. muscae DNA from the faeces from horses (n=46) whose gastrointestinal parasite status had been determined at autopsy and whose faeces were examined previously using a conventional parasitological approach. Of these horses examined at autopsy, some harboured adults of either H. microstoma (n=19) or H. muscae (n=4), and others (n=7) harboured both species. Most of them were also infected with other parasites, including strongylid nematodes (subfamilies Cyathostominae and Strongylinae), bots and/or cestodes; there was no evidence of metazoan parasites in 2 horses. Larvated spirurid eggs were detected in the faeces of 1 of the 30 horses (3·3%) shown to be infected with Habronema at autopsy. For this set of 46 samples, the PCR assay achieved a diagnostic specificity of 100% and a sensitivity of ~97% (being able to specifically detect as little as ~0·02 fg of Habronema DNA). The specificity of the assay was also tested using a panel of control DNA samples representing horse, the gastric spirurid Draschia megastoma and 26 other species of parasites from the alimentary tract of the horse. H. microstoma, H. muscae and D. megastoma could be readily differentiated from one another based on the sizes of their specific amplicons in the PCR. The results of this study showed that the performance of the PCR for the diagnosis of gastric habronemosis was similar to that of autopsy but substantially better than the traditional coprological examination procedure used. The ability to specifically diagnose gastric habronemosis in equids should have important implications for investigating the epidemiology and ecology of H. microstoma and H. muscae.