Vaccination is the most effective way to prevent whooping cough. The DTaP vaccine (diphtheria, tetanus, and acellular pertussis) is recommended for children starting at 2 months of age, with booster shots given throughout childhood. Adolescents and adults should receive the Tdap vaccine to maintain immunity.