(CNNMoney) -- Coca-Cola is getting an extra-big dose of caffeine.
The company announced Thursday it is buying a 17% stake in Monster, the energy drink company, and that the two will swap ownership of some brands.
The $2.15 billion deal will allow each company to focus on its core strengths.
For example, Coca-Cola (KO) will hand Monster (MNST) its energy drink brands, like NOS and Full Throttle. In exchange, the non-energy drinks that Monster produces -- Hansen's Natural Sodas, Peace Tea, Hubert's Lemonade and Hansen's Juice Products -- will become part of Coca-Cola's portfolio.
Related: Food stamp soda ban can save 141,000 from obesity, study says
A deal between the two companies has been rumored for some time, with Coca-Cola trying to reposition itself as Americans consume less soda. Coca-Cola's soft drink production slumped by about 2% last year, while Monster grew by nearly 7% to become the sixth-largest player in the carbonated beverages space, according to data from Beverage Digest.
Related: Coke is coming to K-Cups
The deal also expands Monster's access to Coca-Cola's distribution network. The two have partnered in this area for about six years.
Following the announcement, Monster climbed 21% in after-hours trading. Coke gained about 1%.
Read more at CNNMoney.