Prey traits linking consumer diversity to ecosystem function remain poorly understood. On tropical coral reefs, herbivores promote coral dominance by suppressing competing macroalgae, but the roles of herbivore identity and diversity, macroalgal defenses, and their interactions in affecting reef resilience and function are unclear. We studied adjacent pairs of no-take marine reserves and fished areas on reefs in Fiji and found that protected reefs supported 7-17x greater biomass, 2-3x higher species richness of herbivorous fishes, and 3-11x more live coral cover than did fished reefs. In contrast, macroalgae were 27-61x more abundant and 3-4x more species-rich on fished reefs. When we transplanted seven common macroalgae from fished reefs into reserves they were rapidly consumed, suggesting that rates of herbivory (ecosystem functioning) differed inside vs. outside reserves. We then video-recorded feeding activity on the same seven macroalgae when transplanted into reserves, and assessed the functional redundancy vs. complementarity of herbivorous fishes consuming these macroalgae. Of 29 species of larger herbivorous fishes on these reefs, only four species accounted for 97% of macroalgal consumption. Two unicornfish consumed a range of brown macroalgae, a parrotfish consumed multiple red algae, and a rabbitfish consumed a green alga, with almost no diet overlap among these groups. The two most chemically rich, allelopathic algae were each consumed by a single, but different, fish species. This striking complementarity resulted from herbivore species differing in their tolerances to macroalgal chemical and structural defenses. A model of assemblage diet breadth based on our feeding observations predicted that high browser diversity would be required for effective control of macroalgae on Fijian reefs. In support of this model, we observed strong negative relationships between herbivore diversity and macroalgal abundance and diversity across the six study reefs. Our findings indicate that the total diet breadth of the herbivore community and the probability of all macroalgae being removed from reefs by herbivores increases with increasing herbivore diversity, but that a few critical species drive this relationship. Therefore, interactions between algal defenses and herbivore tolerances create an essential role for consumer diversity in the functioning and resilience of coral reefs.