The stress-gradient hypothesis predicts that interactions among plants are context dependent, shifting from facilitation to competition as environmental stress decreases. Although restricted to facilitation/competition, the mechanistic model behind the hypothesis is easily modified to include other negative interactions that are as important as competition in structuring natural communities, e.g., herbivory. To evaluate this hypothesis we experimentally tested if the balance between the facilitative and trophic effect of an intertidal, burrowing, herbivorous crab in marsh plants is context dependent and shifts from positive to negative as stress decreases. By sampling salt marshes differing in sediment size characteristics, we show that sites with larger sediment particle size had less stressful oxygen levels than sites with fine sediment particles, and that the level of stress was reduced by the presence of crab burrows. We then conducted a factorial experiment manipulating sediment size and crab presence. Results show that, by decreasing soil anoxic stress, crabs increase plant growth in stressful zones, but their ecological importance as herbivores increases in more benign zones. Our findings suggest that the balance between positive and negative interactions along stress gradients is more important than previously perceived and also applies to facilitation and herbivory between animals and plants.