Warren Buffett is intrigued by companies that have strong consumer brands, wide economic moats, and durable demand trends. So it's not much of a shocker that Berkshire Hathaway first invested in Procter & Gamble (PG -0.78%) almost two decades ago. 

While the consumer staples stock is just a tiny fraction of Berkshire's overall portfolio today, it has handily beaten the S&P 500 in the past five years, rising 90% compared to a 56% gain for the broad index. 

For a mature business like Procter & Gamble, this market-thumping performance is impressive. Let's take a closer look at what has led to such a remarkable result for shareholders. 

Durable business 

Procter & Gamble isn't going to excite investors with its high-flying growth potential. After all, it's a gigantic and well-established consumer goods maker, not some early stage software enterprise. This is strikingly evident when looking at sales trends. In the past five fiscal years, revenue increased at a compound annual rate of 4.2%. That's certainly not anything to write home about. 

But what matters for long-term investors is not necessarily how much growth can be achieved in any single quarter or year, but the durability of revenue gains to continue for extended periods of time. Procter & Gamble fits this description well. 

Its economic moat stems from the incredibly popular branded products it sells, like Tide laundry detergent, Head & Shoulders shampoo, Gillette razors, and Crest toothpaste. These items not only drive customer loyalty, as people develop an affinity to their favorite brands that have been built up over years, but they allow the business to flex its pricing power. In the most recent quarter (fourth quarter 2023, ended June 30), Procter & Gamble's sales exceeded Wall Street analysts' estimates by nearly $600 million, thanks to higher prices.  

Moreover, P&G's branded products encourage small, but frequent, purchases. This adds a level of predictability to the business model, no matter what the economic situation may be. 

All these traits are exactly the things that Warren Buffett loves to see in the businesses he owns. Just look at Apple and Coca-Cola, which combined represent more than 50% of Berkshire's public equities portfolio. While in completely different industries, these businesses benefit from powerful brands, customer loyalty, and pricing power. 

Recipe for strong investment returns 

Despite meager sales growth, shares of Procter & Gamble were still able to crush the market in the past five years because of its operating leverage, or the phenomenon that net income increases at a faster rate than revenue. Profits climbed at a compound annual rate of 8.5% between fiscal 2018 and 2023. The business continues to find ways to spread greater revenue over its fixed cost base, leading to outsized bottom-line growth. 

This ability to generate profit results in Procter & Gamble producing consistent free cash flow, which management has used to the benefit of shareholders by conducting stock buybacks and paying a dividend that currently yields 2.5%. A shrinking outstanding share count means that each existing share represents a greater ownership stake in the company. Diluted earnings per share are directly affected, and they've increased at an annualized rate of 10% over the past five fiscal years. 

That alone doesn't fully explain why the stock has done so well. The final ingredient in Procter & Gamble's market-beating performance was the fact that the stock's trailing price-to-earnings ratio went from 22.5 five years ago to 26.2 today. Investors have generally valued shares at a higher multiple over time. 

This is the perfect example of a business that has modest growth prospects, but that still can trounce the market because of rising earnings, favorable capital allocation decisions by management, and an improved valuation.