Coca-Cola on Friday said it had agreed to buy global coffee chain Costa from its UK owner Whitbread for £3.9 billion ($5.1 billion).

"Hot beverages is one of the few remaining segments of the total beverage landscape where Coca-Cola does not have a global brand. Costa gives us access to this market through a strong coffee platform," Coca-Cola chief executive James Quincey said in a joint statement.

The deal comes amid eroding consumer demand for conventional carbonated drinks owing to health and obesity concerns in the US and other markets.

Earlier in August, Coca-Cola's fierce rival PepsiCo struck a deal to buy Israeli company SodaStream for $3.2 billion in a pitch to consumers concerned also about mounting waste from soda cans and plastics in landfills worldwide.

SodaStream makes machines that carbonate home tap water.

Meanwhile following pressure from activist shareholders, Whitbread announced in April that it would spin off Costa, leaving it to concentrate on its hotel chain Premier Inn.

Whitbread was forced to act after US group Elliott became its biggest shareholder with a six percent stake.

"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 chief executive Alison Brittain said in the statement.

"Whitbread will also reduce debt and make a contribution to its pension fund, which will provide additional headroom for the expansion of Premier Inn."

Whitbread bought Costa in 1995 from founders Sergio and Bruno Costa and presently runs about 2,400 stores in the UK and some 1,400 around the world.

Costa also operates more than 8,000 Costa Express self-serve machines in eight countries, as well as placing its products in supermarkets.

Premier Inn has 785 hotels in the UK and a sprinkling of others in Germany and the Middle East.