Fighting with your guy or having your brilliant (or so you thought) ideas vetoed in a meeting can compel you to head straight to the weight room or the running path—and for good reason. A serious sweat session zaps stress, releasing tension and anger, and boosting levels of feel-good brain chemicals including endorphins.

But far from canceling each other out, psychological stress and exercise have a much more complicated relationship—and not always a compatible one. Relationship troubles or pressure at the office can distract your mind and overwhelm your body, derailing your workout routine and preventing you from reaching your fitness and weight-loss goals. But science shows you can learn to harness stress to boost your success in the gym—and outside it.

When you’re facing big deadlines or coping with a family crisis, spin class sometimes falls off your priorities list. Yale University researchers looked at all the studies they could find on stress and exercise habits, and three-fourths showed that people under pressure tend to slack off on physical activity and spend more time sedentary. In one of the studies reviewed, participants were 21 percent less likely to work out regularly during times of stress—and 32 percent less likely to stick to their sweat schedule over the following four years.

Outsmart it: Doing workouts in tandem with other stress-management techniques such as deep breathing may increase the likelihood you’ll follow a regular exercise routine, the study authors suggest. Try a walking meditation, where you focus on paying close attention to your breath and what’s going on around you while you stride. Or even simpler: Smile while you sweat. A study in Psychological Science suggests even faking a half-smile can lower your heart rate and reduce your stress response almost instantly, perhaps because activating facial muscles involved in a cheerful expression sends a happiness-inducing message to your brain.

Stress Hinders Your Recovery

Thinkstock

It’s normal to feel sore the day after bootcamp. But if the after-effects linger and you alter your form powering through your next workout, you increase your risk of injury. People who said they were stressed felt more tired, sore, and low on energy 24 hours after a tough workout than those who reported fewer life pressures, according to a study in the Journal of Strength and Conditioning Research. The researchers suspect the mental demands of stress rob your body of valuable resources; combine that with a tough workout, and you’ll have nothing left in the tank.

Outsmart it: Make sure you’ve recovered enough from one hard workout before you tackle another to-the-max session, says Matt Laurent, Ph.D., an assistant professor of exercise science at Bowling Green State University. Use his simple recovery scale to gauge your status: As you warm up, think about the last time you did the same workout, and rate yourself on a scale of zero to 10 whether you’d be able to crush it again this time. If you’d rate yourself a five or higher—meaning you could complete this workout about as well as or better than last time—you’re good to go. But if you feel like you’d be merely dragging through (a zero through four), consider cutting your session short or picking a lower-intensity routine like yoga.

Stress Slows Down Your Fitness Gains

Thinkstock

When you stick to a gym schedule, your muscles, heart, and lungs adapt over time, making you fitter and stronger. One way experts measure this increase in fitness is by testing your VO2 max, how much oxygen your body uses during a workout. When Finnish researchers monitored 44 people starting a new cycling regimen, those who rated their stress levels highest saw the least improvement in VO2 max in a two-week period, despite doing the same workouts as everyone else.

Outsmart it: Consider the big picture of what’s happening in your life before you set any goals. If you’re planning a wedding or moving, it might not be the best time to set an ambitious new target. “When I have clients choose big goals like a marathon or Ironman, we always try to schedule it when their lives are the least chaotic and they can devote the greatest amount of physical as well as mental energy to their training,” says coach and exercise physiologist Tom Holland, author of The Marathon Method.

Stress Prevents Weight Loss

Thinkstock

Kaiser Permanente researchers put 472 obese adults on a diet and exercise program designed to help them lose 10 pounds in 26 weeks. Before and after, participants took a quiz that ranked their stress levels from zero (blissfully stress-free) to 40 (under major pressure). Those who started the study with higher scores were significantly less likely to hit their goal. In fact, people who gained more than one point on their stress scales during the study were more likely to put on pounds.

Outsmart it: Turn in early: In the same study, adding poor sleep (less than six hours per night) on top of stress slashed the odds of weight-loss success in half. To get a better night’s rest, power down your iPad and laptop at least an hour before heading to dreamland. The blue light of the glowing screen interferes with your body’s production of the sleep hormone melatonin, making it more difficult to drift off or stay asleep, according to a study in the journal Applied Ergonomics.

Stress Can Give You an Extra Push

Thinkstock

There is an upshot to weathering tough times. Basketball players who practiced in stressful situations did better on an anxiety-inducing free-throw performance test five weeks later than those who logged workouts in a relaxed state. For you, that means experience performing under pressure results in confidence that can help you run a faster 5K or ace your next tennis match. What’s more, there’s evidence this self-assurance may also help you do your best at work and in social situations as well, says University of Chicago psychologist Sian Beilock, Ph.D., author of Choke: What the Secrets of the Brain Reveal About Getting It Right When You Have To.

Outsmart it: Research suggests changing your mindset can make the difference between success and failure, Beilock says. Instead of seeing stress as a barrier to your success, view it as an obstacle you’ve overcome in the past—and can conquer again. And if you’re lucky enough to live a low-stress life, consider upping the ante during your workouts to improve your performance when it matters—for instance, racing the clock on your next run or having a friendly circuit-training competition with your gym buddy.