Realty Income (NYSE:O) is a real estate investment trust, or REIT, that focuses on free-standing, single-tenant retail real estate. The company is a large REIT with roughly 5,500 properties in its portfolio rented to 257 different commercial tenants.

It's also worth pointing out that Realty Income is not a pure-play retail REIT. In fact, about 20% of the portfolio consists of nonretail property types, particularly office and industrial properties. This adds an element of diversification, and also gives Realty Income additional opportunities to find value-adding acquisitions.

Having said that, is retail the industry you should be investing in right now? Is Realty Income still a good stock to buy, or should it be avoided as e-commerce continues to evolve and wreak havoc on so many brick-and-mortar retail businesses?

Shelves of medications in a pharmacy.

Drug stores are one of the largest components of Realty Income's portfolio. Image source: Getty Images. (Note: Image does not necessarily depict a Realty Income-owned property.)

The right kind of retail (and some diversification, too)

About 80% of Realty Income's properties (by rent) are occupied by retail tenants. If this scares you, that's totally understandable. There has been an epidemic of retail bankruptcies, store closures, and other struggles. In fact, the day before I wrote this article, massive mattress retailer Mattress Firm declared bankruptcy.

However, most of Realty Income's retail tenants are about as e-commerce-resistant as well as recession-resistant as you can get. Just to name a couple of examples, nearly 11% of Realty Income's portfolio consists of drug stores, which sell products that people need, and often need quicker than online retailers can get them to their door. Dollar stores make up 7.4% of the portfolio, and these businesses offer bargains that e-commerce giants can rarely beat. In fact, Realty Income estimates that a total of 94% of its portfolio income is protected against both e-commerce headwinds and recessions.

Realty Income also has a substantial nonretail component to its portfolio, as I mentioned earlier. Seventeen percent of the portfolio is made up of industrial and office properties, the majority of which are leased to investment-grade tenants. There's a small agricultural component as well. The point is that not only does Realty Income focus on the right kinds of retailers, but it diversifies its portfolio beyond the realm of retail as well.

Built for predictable earnings growth

In addition to focusing on the right kind of properties for long-term investors, Realty Income also has a lease structure that's designed for predictably growing income over time and minimal vacancies.

Specifically, Realty Income's properties are leased to tenants on a "net lease" basis. This means that tenants pay for property taxes, building insurance, and most maintenance expenses, virtually eliminating the variable costs of owning commercial properties. In addition, these leases generally have initial terms of 15 years or more, with pre-agreed rent increases, or escalators, built right in.

In other words, all Realty Income needs to do is to put a tenant in place and enjoy over a decade of predictably growing income.

Realty Income has generated positive FFO growth in 21 of 22 full years as a NYSE-listed stock. This means that Realty Income has performed well in a variety of economic climates, precisely because of its focus on consistency and predictability.

It's tough to find a better dividend track record?

Realty Income is a member of the S&P High-Yield Dividend Aristocrats index, and I've written before that it's tough to find a better dividend track record anywhere in the stock market.

Not only has Realty Income increased its dividend for 84 consecutive quarters at an average annualized growth rate of 4.7%, but it has made 578 consecutive monthly dividend payments (almost 48 years). In fact, shareholders who invested at the time of Realty Income's 1994 NYSE listing have received more than 450% of their original investment back in dividends alone.

Risks to be aware of

I'd call Realty Income a low-risk stock, especially in a long-term context, but there are still some risks that investors should be aware of.

For example, there's always the possibility that one of Realty Income's major tenants will declare bankruptcy. Sure, Realty Income has taken steps to insulate itself from e-commerce headwinds and recessions, but sometimes companies just fail.

Interest rates are another major risk, especially in the short term. REITs tend to move in the opposite direction of interest rates (the 10-year Treasury yield is a good REIT indicator). To be clear, this is likely to trigger stock price fluctuations, but is unlikely to cause much harm to the business itself. Realty Income's debt is largely fixed rate, and its ongoing borrowing needs in any given year are rather small.

Furthermore, while Realty Income's stock may experience some short-term headwinds, it's important to realize that the company's business is great at making money in all different economic climates, including in both rising- and falling-rate environments. In fact, since its 1994 NYSE listing, Realty Income has generated annualized total returns of nearly 16% -- handily beating the S&P 500. Assuming dividend reinvestment, Realty Income has generated a total 3,067% return since that time, compared with just 817% for the S&P 500.

The verdict

Realty Income is certainly the right kind of retail stock to invest in for the long run, especially with the uncertainties e-commerce brings into the industry. In fact, Realty Income is one of the largest stock holdings in my own portfolio and one that I plan to own for decades to come.

You should expect Realty Income's stock price to fluctuate quite a bit over shorter periods, especially when interest rates are in flux like they are now. However, over the long run, the company has done an excellent job of delivering returns in a variety of climates, and there's no reason to believe this will change anytime soon.

Matthew Frankel, CFP owns shares of Realty Income. The Motley Fool has no position in any of the stocks mentioned. The Motley Fool has a disclosure policy.