Vaccines work by imitating an infection, prompting the immune system to build a defense without causing the actual disease. This is achieved through the introduction of weakened or inactivated forms of the pathogen, or parts of the pathogen such as proteins or sugars. The immune system then produces antibodies that can recognize and fight off the actual pathogen if the host is exposed in the future.