The ability to forecast community dynamics requires, among other things, an understanding of indirect effects and nonlinearities in webs of interacting species, together with knowledge of how habitat structure mediates interactions. We explored these aspects for a coral reef system in Moorea, French Polynesia, involving intraguild predation where the shared damselfish prey (juvenile yellowtail dascyllus Dascyllus flavicaudus) and two species of intraguild (IG) prey (the ambush predators arc-eye hawkfish Paracirrhites arcatus and red-spotted coral crab Trapezia rufopunctata) shelter together in branching Pocilloporid corals for protection from mobile IG predators. Field experiments revealed that both IG prey had strong adverse effects on survivorship of juvenile damselfish, but that the dominant underlying process was competition for enemy-free space and not direct consumption. In this case, the combined effect of hawkfish and crabs did not result in either risk enhancement or risk reduction for the damselfish. Similarly, the combined influence of IG predators and IG prey on the shared prey also was indistinguishable from that expected from their independent effects. Habitat structure weakened the IG-prey-IG-predator interaction; IG prey were much stronger space competitors with damselfish than resource competitors with IG predators. As a consequence, there was not a trophic cascade where damselfish benefited by the adverse effect of IG predators on hawkfish or coral crabs. These results highlight the manner by which habitat structure can mediate species interactions and emphasize the need to understand the underlying mechanisms.