Emerging fungal pathogens pose a greater threat to biodiversity than any other parasitic group1, causing declines of many taxa, including bats, corals, bees, snakes and amphibians1â4. Currently, there is little evidence that wild animals can acquire resistance to these pathogens5. Batrachochytrium dendrobatidis is a pathogenic fungus implicated in the recent global decline of amphibians6. Here we demonstrate that three species of amphibians can acquire behavioural or immunological resistance to B. dendrobatidis. Frogs learned to avoid the fungus after just one B. dendrobatidis exposure and temperature-induced clearance. In subsequent experiments in which B. dendrobatidis avoidance was prevented, the number of previous exposures was a negative predictor of B. dendrobatidis burden on frogs and B. dendrobatidis-induced mortality, and was a positive predictor of lymphocyte abundance and proliferation. These results suggest that amphibians can acquire immunity to B. dendrobatidis that overcomes pathogen-induced immunosuppression7â9 and increases their survival. Importantly, exposure to dead fungus induced a similar magnitude of acquired resistance as exposure to live fungus. Exposure of frogs to B. dendrobatidis antigens might offer a practical way to protect pathogen-naive amphibians and facilitate the reintroduction of amphibians to locations in the wild where B. dendrobatidis persists. Moreover, given the conserved nature of vertebrate immune responses to fungi5 and the fact that many animals are capable of learning to avoid natural enemies10, these results offer hope that other wild animal taxa threatened by invasive fungi might be rescued by management approaches based on herd immunity.