SAN FRANCISCO—Standing at a podium in front of an audience of psychiatrists, clinicians and scientists, Firdaus Dhabhar brings up a video of his infant son on a large projector screen and presses play. Smiling and wriggling, Dhabhar's son rests on his back in a doctor's office—perfectly content. "Watch for the immediate reaction," Dhabhar tells the audience. A nurse expertly injects his son's thigh with a vaccine. For half a second, nothing changes. Then the child stops moving; his eyes widen; his face twists into misery as he begins to cry. Meanwhile, the nurse has not missed a beat, injecting several more vaccines. As she leaves she turns to the camera and says, "Sorry I couldn't make him cry more."

Dhabhar likes to film babies crying when they get their shots; he knows that the wailing is a good sign—so do the nurses in the hospitals he frequents. A Stanford University researcher who studies how stress changes the body, Dhabhar and his colleagues have discovered that subjecting mice to minor stress before they are vaccinated boosts the immune system and makes the vaccines more effective. Mice that were stressed out prior to their inoculations had an easier time overcoming a subsequent infection than mice that the researchers left in peace before their shots. Something similar seems to happen to people. In a study of knee surgery patients, for example, Dhabhar and his teammates found that anticipating surgery increases the number of immune cells circulating in the bloodstream in the days preceding the operation. Studies like these have convinced Dhabhar that stress does not entirely deserve its bad reputation, which was one of the main messages of his recent presentation at the annual meeting of the American Psychiatric Association in San Francisco. Some kinds of short-term stress—as opposed to chronic stress—can improve health.

From an evolutionary perspective, the fact that short-term stress revs up the immune system makes sense. Consider a gazelle fleeing a lioness. Once the gazelle's eyes and ears alert its brain to the threat, certain brain regions immediately activate the famous fight-or-flight response, sending electrical signals along the nervous system to the muscles and many other organs, including the endocrine glands—the body's hormone factories. Levels of cortisol, epinephrine, adrenaline and noradrenaline rapidly increase; the heart beats faster; and enzymes race to convert glucose and fatty acids into energy for cells. All these swift biological changes give the gazelle the best chance of escape. At the same time, Dhabhar and others' research suggests, the brain's recognition of a threat prompts the immune system to prepare for potential injury. The spleen and other organs release immune cells specialized for identifying and destroying invaders and healing damaged tissues. After all, even if the gazelle escapes with its life, it may need to heal wounds sustained during its flight and prevent them from becoming infected.

Somewhat paradoxically, cortisol—one of the hormones released during the fight-or-flight response—has long been known to suppress the immune system. Likewise, many people who are continually stressed over long periods of time have unusually low levels of immune activity. But then again, chronic stress can exacerbate allergies, asthma and autoimmune disorders in which the immune system is already overactive. So does stress excite or repress the immune system? Here's where things get even more complicated, as they so often do in biology. The condensed answer is that it all depends on the situation and on the individual. Often, short-term stress activates certain parts of the immune system, but not all its components; in general, chronic stress stifles the immune system, but it may also make it more likely to attack benign tissues. In the study with knee surgery patients, people's immune systems did not all respond to anticipation of the operation in the same way. Some people showed an adaptive response: the number of immune cells in their bloodstream increased in the days before the operation, then decreased as those immune cells migrated to the skin, lymph nodes, mucus membranes and other important sites of battle and repair. Other patients had a maladaptive response: their levels of circulating immune cells hardly increased or even dipped below their baseline level. As you might expect, people with an adaptive immune response recovered from surgery more quickly and more fully than people with a maladaptive response.

In recent decades, it has become increasingly clear that stress changes people's health in subtle and obvious, temporary and enduring ways. In fact, depression and related illnesses may be—at least in part—disorders of handling stress. We all come into the world having inherited genes that partially determine how well we deal with stress. As we grow, our experiences bolster or weaken our innate resilience. For some people, a series of mildly stressful events may be enough to trigger depression or another illness; others will remain resilient through years of chronic stress. It will likely take decades of new research to understand such differences in detail. For now, though, we can at least be sure that it's okay to feel stressed when you get a shot—in fact, it's a good thing.