Abstract We investigated (1) the importance of chemical cues for predator detection by the nocturnal, rock-dwelling velvet gecko, Oedura lesueurii, and (2) how the lizards’ responses to snake odour may have exerted selection on the foraging behaviours of a nocturnal elapid snake. This snake species (broadheaded snake, Hoplocephalus bungaroides) feeds primarily on velvet geckos, and does so by means of a distinctive foraging behaviour: the snakes remain sedentary in rock crevices for days or weeks, waiting to ambush geckos. Behavioural assays showed that geckos that are sympatric with this sedentary ‘ambush’ predator can detect and respond to the scent of the snake. Retreat-site selection experiments showed that geckos are less likely to enter crevices if the snake's scent is distributed over the entire rock surface, rather than localized to a central portion. Together, these data support the notion that the ‘ambush’ predator benefits by remaining sedentary within a retreat-site for long periods, because it thereby minimizes the extent to which it spreads its scent over the rocks forming the crevice. Geckos from a population sympatric with the ‘ambush’ predator responded strongly to the snake scent, but those from an allopatric population did not. Additionally, geckos from sympatric populations were able to detect the scent of a nocturnal snake that does not eat geckos (small-eyed snake, Rhinoplocephalus nigrescens), but did not modify their retreat-site selection or locomotory behaviours in response to this cue. Lizards from allopatric populations apparently did not detect the scent of small-eyed snakes. Collectively, our findings support an interpretation of predator-prey coevolution in the present system, and emphasize the importance of chemosensory cues to these rock-dwelling reptiles.