Few companies have stronger brands than beverage giant Coca-Cola (KO 0.25%). Warren Buffett has known this for decades. Buffett's Berkshire Hathaway still owns around $25 billion worth of Coca-Cola stock, and it hasn't sold a single share since Buffett first invested in the late 1980s.

Well-known and beloved brands are valuable assets in times of elevated inflation. People are less likely to trade down when faced with rising prices at the grocery store if they like the brand. In the second quarter, Coca-Cola was able to leverage this pricing power to grow revenue and earnings. The company did so well, it boosted its guidance for 2023.

Pricing power

Coca-Cola grew revenue by 6% year over year in Q2. Excluding the effect of currency, acquisitions, and divestitures, organic revenue was up 11%.

This growth was almost entirely due to improvements in pricing and product mix. Total concentrate volume grew by just 1%, while pricing was responsible for 10 percentage points of organic revenue growth.

There are limits to Coca-Cola's pricing power, though. CEO James Quincey added some detail during the earnings call:

However, we have seen some willingness to switch to private label brands in certain categories. Across the sector, consumers are increasingly cost conscious. They're looking for value and stocking up on items on sale.

Right now, the company seems to be striking the right balance between raising prices and maintaining market share. It believes it increased its value share of the total nonalcoholic ready-to-drink beverage market in Q2.

Coca-Cola's profit grew even faster than revenue. Adjusted earnings per share, which excludes the effect of currency and other items, grew 17% in Q2.

A stronger 2023

Coca-Cola's strong performance in Q2 prompted the company to raise its outlook for the full year across a variety of metrics. Organic revenue is now expected to grow between 8% and 9%, up from a previous range of 7% to 8%.

Coca-Cola's outlook for commodity price inflation was left unchanged. The company still sees higher input prices having a mid-single-digit percentage negative effect on the cost of goods sold. Even accounting for this headwind, Coca-Cola expects to grow adjusted earnings per share by between 9% and 11%. That's up from a previous guidance range of 7% to 9%. There was no change to the company's free cash flow outlook of $11.4 billion.

Is Coca-Cola stock a buy?

Coca-Cola stock is not cheap, but it's hard to find a higher-quality company in the packaged food industry.

Based on the average analyst estimate for full-year adjusted earnings per share, Coca-Cola stock trades at a price-to-earnings ratio of about 27. That's pricey considering Coca-Cola's growth rate, but what you're paying for is safety. Coca-Cola has been around for more than 100 years, and its namesake brand has stood the test of time. Paying a premium for that track record can make sense.

You're also paying for a solid dividend. Coca-Cola's latest quarterly dividend payment of $0.46 per share works out to a dividend yield of 2.9%. For comparison, the S&P 500 currently sports a dividend yield of just 1.51%. The dividend is set to consume around 70% of Coca-Cola's free cash flow this year, so it isn't going to grow any faster than the company grows its free cash flow in the years ahead. While dividend growth may be slow, the company has hiked the dividend annually for 61 consecutive years.

You often get what you pay for in the stock market. While the stock is priced at a premium, Coca-Cola is a great company worth investing in for the long haul.