Stroking of the skin produces pleasant sensations that can occur during social interactions with conspecifics, such as grooming. Despite numerous physiological studies (reviewed in ref. 2), molecularly defined sensory neurons that detect pleasant stroking of hairy skin in vivo have not been reported. Previously, we identified a rare population of unmyelinated sensory neurons in mice that express the G-protein-coupled receptor MRGPRB4 (refs 5, 6). These neurons exclusively innervate hairy skin with large terminal arborizations that resemble the receptive fields of C-tactile (CT) afferents in humans. Unlike other molecularly defined mechanosensory C-fibre subtypes, MRGPRB4(+) neurons could not be detectably activated by sensory stimulation of the skin ex vivo. Therefore, we developed a preparation for calcium imaging in the spinal projections of these neurons during stimulation of the periphery in intact mice. Here we show that MRGPRB4(+) neurons are activated by massage-like stroking of hairy skin, but not by noxious punctate mechanical stimulation. By contrast, a different population of C fibres expressing MRGPRD was activated by pinching but not by stroking, consistent with previous physiological and behavioural data. Pharmacogenetic activation of Mrgprb4-expressing neurons in freely behaving mice promoted conditioned place preference, indicating that such activation is positively reinforcing and/or anxiolytic. These data open the way to understanding the function of MRGPRB4 neurons during natural behaviours, and provide a general approach to the functional characterization of genetically identified subsets of somatosensory neurons in vivo.