The glycoprotein B (gB) and D (gD) genes from five ruminant alphaherpesviruses, bovine herpesvirus 1 (BHV-1), bovine herpesvirus 5 (BHV-5), caprine herpesvirus 1 (CapHV-1), cervine herpesvirus 1, and rangiferine herpesvirus 1, were partially sequenced. The nucleotide sequence alignments revealed a highly conserved gB gene, with homologies ranging between 87.2 and 99.6%, and a more variable gD gene, with homologies ranging between 71.3 and 98.9%. The phylogenetic analysis of the gB and gD nucleotide and deduced amino acid sequences revealed that BHV-5 is the most closely related virus to the BHV-1 subtype 1 and BHV-1 subtype 2 cluster and that CapHV-1 is the most distantly related virus. The phylogenetic data showed a close relationship of all the studied viruses with suid herpesvirus 1. On the basis of sequence data for the gB gene, a nested PCR combined with restriction enzyme analysis (REA) of the PCR products was developed for the simultaneous detection and identification of the viruses that were studied. Nested primers from highly conserved sequence stretches were selected in order to amplify a region of 294 bp in all five viruses, and a subsequent REA of the PCR products allowed specific identification. A mimic molecule that served as an internal standard of the amplification efficiency was constructed. The practical diagnostic applicability of the assay was evaluated with clinical samples consisting of semen and organ specimens from experimentally infected animals.