The puzzling diversity of flowers is primarily shaped by selection and evolutionary change caused by the plant’s interaction with animals. The contribution of individual animal species to net selection, however, may vary depending on the network of interacting organisms. Here we document that in the buckler mustard, Biscutella laevigata, the crab spider Thomisus onustus reduces bee visits to flowers but also benefits plants by feeding on florivores. Uninfested plants experience a trade-off between pollinator and spider attraction as both bees and crab spiders are attracted by the floral volatile β-ocimene. This trade-off is reduced by the induced emission of β-ocimene after florivore infestation, which is stronger in plant populations where crab spiders are present than where they are absent, suggesting that plants are locally adapted to the presence of crab spiders. Our study demonstrates the context-dependence of selection and shows how crab spiders impact on floral evolution.