In short, vaccines trick your immune system into teaching your body how to defeat its opponents. That way you don't need to get a disease to become immune to it.