The field of ecological immunology is ultimately seeking to address the question ‘Why is there variation in immune function?’ Here, we provide experimental evidence that costs of ubiquitous sexual signals are a significant source of variation in immune function. In the mating season, males of the wolf spider Hygrolycosa rubrofasciata drum against dry leaves while wandering around the habitat searching for receptive females. According to a previous study, the male metabolic rate during the drumming increases 22-fold compared to the resting metabolic rate. In the present study, we examined whether investment in costly courtship drumming decreases male immune function in a wild population of H. rubrofasciata. We induced males to increase their drumming rate by introducing females in proximity. As estimates of male immune function, we used lytic activity and encapsulation rate. Lytic activity estimates the concentration of antimicrobial peptides in haemolymph, which have been shown to play an important role in defence against bacteria, viruses and fungi. Encapsulation is an important defence mechanism against nematodes and insect parasitoids, but it also plays a role in defence against viruses. Our results show that males with nonarbitrarily increased investment in drumming rate had considerably lower lytic activities than control males. Also, there was a tendency for males with nonarbitrarily increased investment in drumming rate to have lower encapsulation rates than control males. This study provides experimental evidence for the first time, to our knowledge, that there are direct immunological costs of sexual signalling in natural populations. Therefore, immunological costs of sexual signals may provide significant phenotypic variation to parasite-mediated sexual selection.