Media playback is unsupported on your device Media caption Whitbread boss Alison Brittain tells Today the deal would boost Costa's global expansion

Coca-Cola is to buy the Costa coffee chain from owner Whitbread in a deal worth £3.9bn.

Whitbread had intended to spin off the chain as a separate firm, but said a straight sale was more profitable.

Chief executive Alison Brittain said Whitbread would now focus on its Premier Inn business in the UK and Germany.

Whitbread bought Costa, which is now the UK's biggest coffee chain, for just £19m in 1995.

At the time, it had just 39 outlets. It now has more than 2,400 UK coffee shops, as well as some 1,400 outlets in 31 overseas markets. Costa Express has 8,237 vending machines worldwide.

Whitbread shares were up 16% in Friday afternoon trading.

Speaking on the BBC's Today programme, Ms Brittain explained that Coca-Cola wanted to buy Costa because "they want the coffee product, they have no coffee in their range".

She said the money from the sale would be used to expand the Premier Inn chain, return some cash to shareholders, pay down debt and boost the pension fund.

Describing the sale as a "win-win" for everyone, she said the price paid by Coca-Cola was far higher than if Costa had been demerged into a stand-alone company on the stock market.

She said she thought the beverage giant would use Costa to create "ready to drink, cold brew coffees".

"You could see Costa absolutely everywhere, in vending machines, hotels, restaurants, pubs, cafes - in all the places you see Coke today," she added.

Coca-Cola chief executive James Quincey told investors on a conference call that Costa was "a winning company that can go global".

He acknowledged that retail sales were a new area for Coca-Cola, but said Costa already had "a strong management team" and that Coca-Cola intended to "make it attractive for them to stay".

Whitbread announced earlier this year that it was planning to spin off Costa.

Whitbread had been under pressure to consider a break-up of the business after hedge fund Elliott Advisors became the company's largest shareholder.

Elliott reportedly put forward a demerger plan after building up a 6% stake in the firm.

As well as being the largest UK coffee chain, Costa is also the world's second largest. It is looking to triple its presence in China, where it is second to Starbucks.

According to consumer analysts Kantar Worldpanel, the out-of-home coffee market is worth £6.3bn a year in the UK alone.

Image copyright Heritage Images

From beer to beans to beds: Whitbread's long history

1742 - Samuel Whitbread forms partnership with Godfrey and Thomas Shewell

1750 - Whitbread creates UK's first mass-production brewery in London

1868 - Begins producing beer in bottles

1968 - Starts brewing Heineken under licence

1974 - Opens first Beefeater steakhouse

1990s - Buys David Lloyd Leisure, Marriott Hotels, TGI Fridays, Pizza Hut, Premier Lodge

1995 - Buys Costa Coffee from Sergio and Bruno Costa for £19m when it had 39 outlets

2000 - Sells brewing business to focus on Premier Inn and Costa

Whitbread also owns restaurants Beefeater and Brewers Fayre. Over the years, it has owned well-known brands such as TGI Fridays, Pizza Hut and Marriott Hotels.

The deal is subject to the agreement of Whitbread's shareholders and various other approvals, including from anti-trust regulators.

It is expected to complete in the first half of next year.

Analysis: Dominic O'Connell, Today business presenter

For years, demerger was a dirty word at Whitbread. When asked, as they often were, about the logic of having a hotel chain and a coffee chain in the same company, executives would extol the benefits of having two leisure brands under one roof.

Shareholders were always less convinced, but were happy to go along with the idea while Whitbread grew its revenue, profits and share price at a steady clip over the last decade.

All that changed with the arrival of Alison Brittain as chief executive - and the appearance on the shareholder register of Elliott Management, an aggressive, deep-pocketed US hedge fund with a track record of shaking up big companies. It pushed hard for a demerger, and Ms Brittain, who judged that Costa and Premier had reached sufficient scale to stand on their own feet, opened the door.

The plan was that Costa would be spun off at some time in the next two years, but Coca-Cola pre-empted that with a knockout offer.

While this is a landmark deal for Whitbread, it is also a significant move for Coca-Cola, taking it into hot beverages for the first time and, it hopes, providing the growth for which its investors have been crying out.

Nicholas Hyett, equity analyst at Hargreaves Lansdown, described the deal as "a bitter-sweet moment for Whitbread investors".

"On the one hand, £3.9bn is an undeniably rich valuation and likely far better than Costa could achieve as an independently listed company, valuing its earnings higher than those of the mighty Starbucks," he said.

"On the other, Costa has long been the jewel in Whitbread's crown and some will be sad to see it go at any price, especially given the growth potential in China and elsewhere."