In this study blood samples were collected from 193 goats in north and northeastern Iran with the aim to develop a PCR-RFLP assay, as a specific and sensitive diagnostic tool enabling direct and concurrent identification of two Anaplasma species (A. ovis, A. marginale) in goats. A polymerase chain reaction (PCR) for amplification of a fragment of the major surface protein 4 (msp4) gene from A. ovis and A. marginale was developed. The results revealed that 123 out of 193 blood samples were positive for Anaplasma spp.infection. All 43 positive samples detected by microscopic examination were approved as positive by PCR, whereas no rickettsials were seen through light microscopy in the other 80 PCR positive cases. All positive samples were A. ovis as confirmed by restriction fragments length polymorphism (RFLP) method. Our results showed that PCR-RFLP of the msp4 gene could be a useful method for the detection of A. ovis in goats.