Our understanding of how biodiversity influences ecosystem functioning is entering a new stage of its development through the incorporation of information about the evolutionary relatedness of species. Bacteria are prime providers of essential ecosystem services, representing an excellent model system to perform biodiversity-ecosystem function research. By using bacteria isolated from petroleum-contaminated sites, we show that communities composed of poorly related species were more productive than those containing highly related species. The nature of the forces controlling this positive effect of phylogenetic diversity on community productivity depended on the number of species in culture. In communities of two species the positive effect of phylogenetic diversity on productivity was driven by changes in the selection effect. Communities of two distantly related species were dominated by the most productive species in monoculture, whereas communities of two closely related species were dominated by the less productive species in monoculture. In communities of four species the positive effect of phylogenetic diversity on productivity was driven by changes in the complementarity effect. In communities composed of four distantly related species the influence of positive interactions such as facilitation, cross-feeding, and niche partitioning seemed to outweigh the influence of negative interactions such as interference. As a consequence the proportion of species favored by the presence of other species increased as they became less related. Multiple facets of biodiversity may influence ecosystem functioning. Here, we present evidence of an interaction between phylogenetic and taxonomic diversity on community productivity, underlining the importance of considering multiple aspects of biodiversity when studying its impact on ecosystem functioning.