U.S. swimmer Elizabeth Beisel did something a little crazy at the 2012 Summer Olympics in London. Before the biggest races of her life, she tried a performance-enhancing substance: coffee.

The results were electric. She swam two personal-best times and won a silver medal in the 400-meter individual medley and a bronze in the 200-meter backstroke.

At first, coffee’s impact was “100 percent physical. I could truly feel the effects on me,” recalls Ms. Beisel, who is headed back to the Olympics in Rio de Janeiro in August. “Now, it may be more mental than it is physical. It’s just become part of my routine.”

Caffeine is an oddity in sports, especially given recent doping allegations against elite athletes. It aids athletic performance, research shows, yet it is completely legal.

Long used by triathletes and marathoners as a pick-me-up, caffeine is showing benefits even in short-burst and team sports like jujitsu, sprint swimming and rugby. Recent research suggests that even small doses of caffeine, equivalent to what’s in a “tall” Starbucks coffee, can improve athletic performance.

“I’d say at the elite level, the majority of athletes use caffeine,” says Steve Magness, cross-country coach at the University of Houston and author of “The Science of Running.” Many dietary supplements are unproven, Mr. Magness says, but caffeine “just consistently, repeatedly works.”

Research shows caffeine can confer a 1 percent to 2 percent benefit, he says. That won’t turn a couch potato into a world-record holder. But it’s significant for competitive margins measured in seconds or fractions of a second.

Click for more from The Wall Street Journal.