There has been a lot of debate over the years about whether stocks or real estate is a better investment for the long haul. That's because they've been running a tight race for decades, with one side pulling ahead at times only to give way to the other after a strong year. Because of that, it isn't easy to declare a true winner, especially in an ongoing race.

However, at this point, historical data does show a clear leader: real estate investment trusts (REITs). Here's a look at how the overall sector, its subgroups, and a few noteworthy REITs have performed versus the S&P 500 over the long term.

Digging into the historical data: REITs vs. stocks

The U.S. Congress established REITs in 1960 to provide all investors with the same access to income-producing real estate that was once only available to wealthy individuals. The National Association of Real Estate Investment Trusts (NAREIT), which formed that same year, has been keeping track of historical return data for the REIT sector since 1972. It has developed several indexes to track returns, led by the FTSE NAREIT All Equity REIT Index. This index contains all 12 equity REIT subsectors (it excludes mortgage REITs, which aren't classified in the real estate sector but are instead considered financial companies).

Here's a look at how this index has performed versus the S&P 500 over the years:

Time period S&P 500 (total annual return) FTSE NAREIT all equity REITS (total annual return)
1972-2019 12.1% 13.3%
The last 25 years 11.9% 12.6%
The last 20 years 7.7% 13.3%
The last 10 years 14.2% 13.2%
The last 5 years 12.5% 9%
The last year (2019) 31.5% 28.7%

Data source: NAREIT and Slickcharts.

As that data shows, REITs have outpaced the S&P 500's total return since NAREIT began tracking their performance in 1972. Thus, one could definitively state that REITs have outperformed stocks over the long term. Though that could change if the S&P 500 outpaces REITs by a wide margin in the coming years.

That has certainly been the case in more recent years as stocks outperformed REITs in 2019 and the prior five- and 10-year periods. However, REITs have come out ahead over much longer timeframes as they've outpaced stocks during the last 20- and 25-year periods.

What REIT subsectors have done the best at outperforming stocks?

While the overall REIT sector has outperformed the market over the long term, some subgroups have stood out. NAREIT has been tracking this data since 1994 for most property sectors (timberinfrastructuredata centers, and specialty are newer entrants to the REIT sector and thus only have a few years of tracking data).

Here's a look at how the various subgroups have performed versus the S&P 500:

REIT subgroup Average annual total return (1994-2019)
Office 12.9%
Industrial 14.1%
Retail 12%
Residential 13.7%
Diversified 9.8%
Health Care 13.4%
Lodging/Resorts 10.2%
Self-Storage 16.7%
S&P 500 9.3%

Data source: NAREIT and Slickcharts.

As that table shows, each of the major REIT subgroups has outpaced the S&P 500 since NAREIT began tracking its results.

Self-storage REITs stand out as they've beaten all other subgroups by a wide margin since 1994. These REITs also outperformed the market over the last 10 years (16.7% vs. 14.2% for the S&P 500). However, the group has lagged in more recent years (10.6% over the previous five years and 13.7% in 2019).

Driving the subsector's longer-term outperformance is that self-storage properties tend to have low construction and operating costs, making most units profitable at lower occupancy rates. On top of that, most leases are month to month, enabling self-storage owners to more quickly increase prices to reflect current market rates. Meanwhile, the more recent underperformance is primarily due to overcapacity as investors built more units than the market needed because of the sector's above-average long-term returns.

Another standout REIT subsector has been industrial, which has handily beaten the S&P 500 since 1994. It has also outperformed the market during the last five years (20% vs. 12.5% for the S&P) and 2019 (48.7% vs. 31.5%). Meanwhile, it has narrowly trailed the market over the past 10 years (14.1% vs. 14.2%).

Driving the subsector's strong results, especially more recently, has been the rise in e-commerce. With more people shopping online, industrial REITs, especially those focused on logistics properties, have expanded rapidly by developing new distribution centers to support this growth.

Meanwhile, as noted earlier, NAREIT has added four property types to its tracking in recent years. Here's how these newer subsectors have performed versus stocks since their inception:

REIT subgroup First year tracked Total return S&P 500
Timber 2011 10.5% 11.7%
Infrastructure 2012 19.1% 13.2%
Data Centers 2015 17.3% 10.2%
Specialty 2015 11.1% 10.2%

Data source: NAREIT and Slickcharts.

As that chart shows, all but the timber subgroup have outpaced the broader stock market since NAREIT started tracking these new property classes. The outperformance has been especially noteworthy in data-related real estate as infrastructure (mainly cell tower REITs) and data centers have significantly outpaced the market since joining the REIT sector. Powering their outsized gains has been the explosive growth in data usage over the past several years, driving the need to build more of the real estate required to support demand.

It's also worth pointing out that while all REIT subgroups have beaten the S&P 500 since NAREIT started keeping data in 1994, several haven't performed quite as well in recent years. For example, diversified REITs -- which have just barely squeaked by the S&P 500 since 1994 -- have trailed in most other periods (9.8% vs. 14.8% over the last 10 years and 4.3% vs. 12.5% during the past five). Other more recent laggards have included retail (12% and 1.3% in the past 10- and five-year periods) and lodging/resort (10.2% and 2% during those same time frames).

What REITs stand out versus the stock market?

While REITs as an overall group have outperformed stocks, and certain subgroups have done even better during most periods, some individual REITs stand out as consistent long-term outperformers.

For example, the REIT sector leader in the last decade was self-storage REIT Extra Space Storage (NYSE:EXR). It was the top-performing REIT stock in the period (2010-2019) with an overall total return of 1,179%, which was three times the average return of its publicly traded storage REIT peers. Extra Space's performance obliterated the S&P 500's 256% total return during that time frame, notching the 11th best overall total return in the S&P 500.

Another standout REIT performer has been leading industrial REIT Prologis (NYSE:PLD). The company has vastly outpaced the S&P 500's total return during the last one-, three-, five-, and 10-year periods as well as since its formation in 1998. One factor driving its more recent outperformance has been superior growth in its core FFO and dividend versus the S&P 500, its logistics peers, and the REIT sector average:

Core FFO per share 1-year 3-year 5-year
Prologis 10% 10% 12%
Other logistics REITs 5% 6% 6%
REIT average 5% 5% 5%
S&P 500 average 1% 11% 7%

Data source: Prologis.

Divided per share 1-year 3-year 5-year
Prologis 10% 8% 10%
Other logistics REITs 6% 5% 6%
REIT average 3% 5% 6%
S&P 500 average 10% 7% 9%

Data source: Prologis.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.