Ecological immunology is based upon the notion that activation and use of the immune system is costly and should thus be traded off against other energy-demanding aspects of life history. Most of the studies on insects that have examined the possibility that mating results in trade-offs with immunity have shown that mating has immunosuppressive effects. The connection between mating and immunity has traditionally been investigated using indirect measures of immunity. However, studies that have assessed the effects of mating on the resistance against real pathogens have had conflicting results. A previous study on Tenebrio molitor showed that copulation decreases phenoloxidase activity in the haemolymph, and concluded that copulation corrupts immunity in this species. In the present study we tested whether mating also affects the ability of T. molitor to resist the entomopathogenic fungus, Beauveria bassiana. Interestingly, we found that mating enhanced resistance against the fungal infection and that the effect was stronger on males than females. Furthermore, we found that male beetles were overall more susceptible to the fungal infection than were females, indicating an immunological sex difference in immunity. Our study highlights the importance of the use of real pathogens and parasites in immuno-ecological studies.