Phylum- and class-specific PCR primers were tested for the production of clone libraries and for denaturing gradient gel electrophoresis (DGGE) analysis of complex bacterial communities. Primers were designed to specifically amplify 16S rRNA gene fragments of the phyla Bacteroidetes, Planctomycetes and Firmicutes, of three classes of the phylum Proteobacteria, the Alphaproteo-bacteria, Betaproteobacteria and Gammaproteobacteria, and of the Cyanobacteria (including chloroplast 16S rRNA genes). The specificity of the seven primer pairs was tested by producing clone libraries from environmental DNA samples from mesotrophic (Norwegian coastal) and oligotrophic (Northern Atlantic Gyre) environments. Five of the seven primer pairs specifically amplified target 16S rRNA gene sequences. Exceptions were the Betaproteobacteria- and Firmicutes-specific primers, which were relatively successful with coastal water mesocosm samples but less so with the Northern Atlantic Gyre sample. Phylogenetic analysis of sequences from the Gammaproteobacteria clone library revealed that the coastal sample yielded a number of clones that clustered within clades that belong to the oligotrophic marine Gammaproteobacteria (OMG) group, indicating that this group is not confined exclusively to the oligotrophic environment. Comparison of the bacterial diversity of the environmental DNA sample from the coastal and the open ocean using a two- or three-step nested PCR-DGGE process revealed significant differences in the bacterial communities. The application of the group-specific primers provides a higher resolution genetic fingerprinting approach than existing DGGE primer sets.