Costa has almost 4,000 stores across 32 countries.
Coca-Cola boss James Quincey said: "Costa gives Coca-Cola new capabilities and expertise in coffee, and our system can create opportunities to grow the Costa brand worldwide.
Paying about 1 billion pounds (US$1.3 billion) more than some analysts had expected, Coke will use its distribution network to supercharge Costa's expansion as it chases current coffee chain market leader Starbucks and its nearly 29,000 stores across 77 markets. And in May, Nestle paid more than $7 billion for the rights to sell Starbucks coffee and tea in supermarkets and other stores outside its coffee shops.
Whitbread will now focus on the growth opportunities for its leading hotel business, Premier Inn, in the United Kingdom and Germany. JAB, the Luxembourg-based holding company that owns brands like Krispy Kreme and Peet's Coffee, bought United Kingdom sandwich and coffee chain Pret A Manger in May.
Besides its thousands of retail stores, Costa Coffee also has smaller on-the-go outlets called Costa Express, a roastery and for-home coffee products. Quincey indicated that one potential early expansion route would be to use Costa's vending operation and expand the company's ready-to-drink products. In 2017, it generated operating income of $9.7 billion on revenues of $35.4 billion.
IPhone XS leaked image shows off larger display and gold finish
It's now unclear if Apple will save this announcement for later in the year or reveal all alongside its new range of phones. Some rival smartphones, Samsung's Galaxy Note 9, make it easy to use accessories like a stylus with your smartphone.
Whitbread acquired Costa in 1995 from its founders, Sergio and Bruno Costa, and presently runs about 2,400 stores in the United Kingdom and some 1,400 around the world.
The deal, expected to complete in the first half of 2019, plugs a big hole in Coca-Cola's portfolio.
Then Coca-Cola got in touch with what Whitbread said was a "highly compelling" offer.
"The announcement today represents a substantial premium to the value that would have been created through the demerger of the business and we expect to return a significant majority of net proceeds to shareholders".
Whitbread shares soared almost 20% in early morning trade, catapulting it to the top of the FTSE 100. Some will be used to pay down debt and to make a contribution to the pension fund.
Asked if Whitbread had been pressured to accelerate the sale by activist investor Elliott and other hedge funds, Chief Executive Alison Britain said no.