Among the modern world’s bitterest rivalries (Red Sox versus Yankees, CrossFit versus joy) lies Coca-Cola and Pepsi. The battle spans generations of pop drinkers. Multi-million-dollar marketing campaigns have engendered lifelong Coke loyalists, those who swear by Pepsi, hipster antagonists who insist their brand is RC Cola, and a growing phalanx of the health-conscious who’d just as soon quit soda altogether.

There is, however, one battleground where a clear victor emerged, decades ago, and it’s cocktails. If you can’t remember the last time you ordered a rum and Pepsi, it’s because nobody orders rum and Pepsi. (Or a Jack and Pepsi, for that matter.) In bars around the world, the nomenclature is set in stone: It’s a Rum and Coke.

Few know how Coca-Cola won the cocktail wars. Sure, Coke came first. But the early bird doesn’t always get the market share. (Remember Friendster? Neither does Mark Zuckerberg.) Coca-Cola’s path to the peak of the cocktail kingdom took several dramatic turns. And like all good stories, at the heart of it, there’s a song.

Get the latest in beer, wine, and cocktail culture sent straight to your inbox.

In 1886, Atlanta pharmacist John S. Pemberton created a flavored syrup, trotted it down to his neighborhood pharmacy to mix with carbonated water, and birthed a legend. Coca-Cola become the world’s No. 1-selling sparkling beverage, fending off a slew of imitators. Early efforts to distinguish Coca-Cola included designing its signature contoured bottle and handing out coupons for free samples, before coupons were really a thing.

Thirteen years after Coke came Pepsi-Cola, a Caleb Bradham invention. Pepsi has always struggled to catch its first-to-market rival, but in the cocktail wars, the odds were particularly tough. People started mixing soda with booze during Prohibition to mask the acrid taste of bathtub moonshine, says Tristan Donovan, author of the 2013 book “Fizz: How Soda Shook up the World.”

Coca-Cola was associated with rum as far back as 1902, when the company shipped batches to Cuba for use in its most popular cocktail, the Cuba Libre. Cuba was celebrating independence after its hard-fought Spanish-American War, and the Cuba Libre was its victory drink.

In those days, says cocktail specialist Jared Brown, the cocktail was made with rum, honey, and lemon or lime juice. After Coca-Cola came to town, the Cuba Libre swapped the honey for Coke. (Today many Havana bartenders reportedly use the more widely available, Cuban-made tuKola. The cocktail is nonetheless viewed as a Coca-Cola vehicle, as in, “Cuba Libre, better known as Rum and Coke.”)

Back in the U.S., at the turn of the 20th century, the soda juggernauts were battling out space at soda fountains. Coke was in the lead, Pepsi at a respectable second — until a post-WWI European sugar shortage in the 1920s nearly put everyone out of business: Coke, Pepsi, and the precursor of RC Cola, Chero-Cola.

Coke, Pepsi, and Chero-Cola all started stockpiling as much sugar as they could, paying exorbitant prices. Eventually, agriculture caught up. “Supplies kicked back in and prices collapsed,” Donovan says, leaving soda companies with piles of overpriced sugar and empty bank accounts. “They were speculating, and got it all wrong.”

Pepsi and Chero-Cola went bankrupt. Coke borrowed a bunch of money from a bank, handing over its prized secret formula as collateral, and survived. The timing was particularly auspicious: The American cocktail was on the rise.

“Coca-Cola had the market all to itself,” Donovan says of Coke’s fortuitous positioning in emerging cocktail culture. “The main rival then was a drink called Moxy, which was almost bitter.”

It wasn’t until 1929 that Pepsi got its second chance. An NYC candy shop owner, Charles Guff, didn’t like the prices Coke was charging him, so he went to Pepsi to negotiate. Guff wound up taking over marketing for the now-limping brand. His approach was simple: sell Pepsi for less. It worked in the sense that Pepsi clawed its way back to relevance, and remains a Coca-Cola rival today.

But Goff was too late to muscle back into the bar scene. “Mixers didn’t really feature very heavily for Pepsi,” Donovan says. Pepsi had already lost that war, thanks largely to a single song.

In the 1940s, aspiring actor and songwriter Morey Amsterdam, who later played Buddy Sorrell on “The Dick Van Dyke Show,” wrote a song called “Rum and Coca-Cola.” (Or, rather, Amsterdam Americanized an existing Trinidadian calypso song and sold it as an original.)

Before it was released in the United States, the maker of Pepsi called him and “offered him a lot of money” to change the lyrics to “Rum and Pepsi-Cola,” Brown says. “He thought about it for a few minutes, called the Coca-Cola Company to see if they would offer a higher bid, and by the end of the day was a wealthy man.”

The Andrews Sisters recorded Amsterdam’s song, but it was kicked off radio networks and banned from Hollywood pictures because it so blatantly promoted a brand, Brown says. Amsterdam still printed a record 300,000 copies of the calypso ditty, and the Andrews Sisters played it live across the country. “Rum and Coca-Cola” became the second-largest grossing song of the 1940s, second only to “White Christmas.” 

“That really was the tipping point,” Brown says of the song’s lasting impact. “Bars have used Pepsi, but customers have always and will likely always order a rum and cola as Rum and Coke, in the same way people speak of Kleenex no matter what brand the tissues really are.”

People do order variations of a Rum and Coke, says Philip Dobard, director of The Museum of the American Cocktail. Some order a “Captain Pepper” (rum and Dr. Pepper) or a “Cuba Light” (with Diet Coke). Coca-Cola, however, remains the standard bearer.

“Coca-Cola and rum make for a happy marriage. They just work better together,” Dobard says. “A flavor scientist could tell you why.” Or, perhaps, a songwriter.