When Warren Buffett, the chairman and CEO of Berkshire Hathaway, likes a stock, it's a big deal. As one of the greatest and most celebrated investors of all time, Buffett's moves are closely scrutinized and can move markets. 

There are few stocks that Buffett likes more, judging by his huge commitment to it, than Moody's (MCO -1.58%). Buffett has held the stock for more than 20 years, making it one of his longest-held positions, not to mention one of his largest. Here's why you should follow Buffett's lead and consider adding this credit rating and data analytics company to your portfolio.

A person at their desk, checking their stocks on two computer monitors while speaking with someone on the phone.

Image source: Getty Images.

No Moody's blues

Moody's assesses companies' and governments' credit risk and provides analytics for businesses -- and it's been one of the most consistent stocks on the market. Investors have enjoyed a 27.6% annualized return over the past 10 years, as of Oct. 15.

Its strong performance starts with a largely impenetrable moat. Moody's is one of three major credit rating agencies, which control about 95% of the market. Moody's and S&P Global are the two dominant players, with about 40% market share each (Fitch Ratings is a distant third). It's such a wide and deep moat because there are a lot of legal and regulatory hoops to jump through to get in this business, but more important, the industry doesn't need more than a few players -- otherwise the standard could be watered down. This is one of the things Buffett loves about Moody's.

The other great thing about Moody's is the analytics business, which accounts for about 37% of revenue. In this business, Moody's provides financial intelligence, risk management, analytical, and other data to help business leaders make better and faster decisions. Over the last five years, Moody's has invested in this business big-time, making several acquisitions, and has just about doubled its revenue. This business is a great diversifier for when debt issuance slows down. When that happens, revenue for the credit rating business, called Moody's Investor Services, may slow down, but the data and analytics side tends to perform well when markets don't, as companies need risk management and analytics to navigate choppy markets. This helps smooth out revenue.

In the second quarter, MIS revenue was up 4.5% year over year to $980 million, which is below its long-term growth rate, but analytics revenue was up 15.3% to $573 million. We'll get our next look at Moody's results when the company reports third-quarter earnings later this month.

Buying spree

With the moat around its MIS business, Moody's will continue to enjoy consistent earnings for years to come. But the added strength of the data and analytics side of the business makes it perhaps an even better bet. Last year, Moody's acquired Regulatory DataCorp, which helps companies comply with anti-money laundering and know-your-customer regulations; and ZM Financial Systems, which offers risk and financial management for banks. This year, it has purchased Catylist, which provides analytics for commercial real estate industry; Cortera, a leader in credit data and insights; and RMS, a global provider of climate risk analytics.

These companies all expand the capabilities of Moody's Analytics, and allow it to launch new products, like its ESG Score Predictor, which it introduced this quarter. This tool helps clients produce environmental, social, and governance scores for more than 140 million small and medium-sized companies and enterprises so they can adequately assess their risks.

While it's growing its analytics business, Moody's is maintaining its leadership in credit ratings. Add it all up and you get a consistently high-margin business, including a 48.7% operating margin and a 36.1% profit margin. Also, with income that is derived from fees and subscriptions, it is very efficient, with a return on equity of 116%. It's a great business that's hugely profitable -- so it's no wonder Warren Buffett likes it so much.

This excellence does come at a price: Moody's has a high valuation, with a price-to-earnings ratio of about 33. That's a little higher than its norm over the past decade. But with its high earnings and consistent performance -- which should continue into the future, given its advantages -- Moody's has earned a premium for reliability. In fact, the forward P/E is expected to be down slightly to around 29.

As always, do your own research, but if you're looking for a blue-chip investment with room to grow, you'll find that there's a lot to like about Moody's.