Vaccinations play a significant role in preventing certain STIs. For example, the HPV vaccine can protect against the strains of HPV that cause most cases of cervical cancer and genital warts. The hepatitis B vaccine is another important vaccination that helps prevent a virus that can be sexually transmitted.