Vaccines work by injecting a dead or damaged variant of a virus into a person. Once injected, the dead or damaged version of the virus promotes the creation of antibodies. Antibodies fight and destroy virus particles in order to defend human cells from harm.
Antibodies being produced by the body as a reaction to a virus or vaccine is called active immunity.
The vaccine for polio was invented as a dead version of the polio virus injected into humans.
This is an image of a vial of smallpox vaccine -- smallpox is a virus that can be vaccinated against.