Melatonin modulates a wide range of physiological functions with pleiotropic effects on the immune system. Despite the large number of reports implicating melatonin as an immunomodulatory compound, it still remains unclear how melatonin regulates immunity. While some authors argue that melatonin is an immunostimulant, many studies have also described anti-inflammatory properties. The data reviewed in this paper support the idea of melatonin as an immune buffer, acting as a stimulant under basal or immunosuppressive conditions or as an anti-inflammatory compound in the presence of exacerbated immune responses, such as acute inflammation. The clinical relevance of the multiple functions of melatonin under different immune conditions, such as infection, autoimmunity, vaccination and immunosenescence, is also reviewed.