Vaccines work by making us produce antibodies to fight disease without actually infecting us with the disease. If the vaccinated person then comes into contact with the disease itself, their immune system will recognise it and immediately produce the antibodies they need to fight it.
The following link explains the NHS immunisation schedule.