Many species approach, inspect and signal towards their predators. These behaviours are often interpreted as predator-deterrent signals-honest signals that indicate to a predator that continued hunting is likely to be futile. However, many of these putative predator-deterrent signals are given when no predator is present, and it remains unclear if and why such signals deter predators. We examined the effects of one such signal, the tail-flag display of California ground squirrels, which is frequently given both during and outside direct encounters with northern Pacific rattlesnakes. We video-recorded and quantified the ambush foraging responses of rattlesnakes to tail-flagging displays from ground squirrels. We found that tail-flagging deterred snakes from striking squirrels, most likely by advertising squirrel vigilance (i.e. readiness to dodge a snake strike). We also found that tail-flagging by adult squirrels increased the likelihood that snakes would leave their ambush site, apparently by elevating the vigilance of nearby squirrels which reduces the profitability of the ambush site. Our results provide some of the first empirical evidence of the mechanisms by which a prey display, although frequently given in the absence of a predator, may still deter predators during encounters.