A technique used to cause an immune response that results in resistance to a specific disease, especially an infectious disease.