Source: The Motley Fool

If you love money, this will blow your mind.

In 1980, had you invested a mere $1,000 in what went on to become the top-performing stock of S&P 500 (^GSPC -0.75%), then you would be sitting on a cool $1.2 million today.

That equates to a total return of 120,936%.

The stock? None other than Gap (GPS 0.55%).

You read that right. According to an analysis of the "entire universe of U.S. based stocks publicly traded since 1980," M&T Bank found that the multi-branded retailer scored the top spot among all of the stocks that are currently on the S&P 500.

What's perhaps more interesting is that Gap was in exceptionally good company, as four of the top five S&P 500 components on the list were all retailers.

You can see evidence in the following graphic, which charts how much a $1,000 investment in 1980 would be worth with respect to each of these stocks today.

Coming in second is L Brands (BBWI -0.75%), the retail concern behind Victoria's Secret and Bath & Body Works, among others, with a compound annual growth rate of 22.9%. Third is TJX (TJX 0.95%), the "off-price apparel and home fashions retailer" behind T.J. Maxx and Marshalls, among others, with a CAGR of 22.8%. And in fourth place is Wal-Mart (WMT 0.39%), the world's largest retailer, with a CAGR of 21.9%.

It's also worth pointing out that all of these are, to varying extents, discount retailers that were positioned perfectly to take advantage of the Great Bull Market that got under way in 1982. And all of them have since grown alongside the American consumer. Their total returns (rounded to the nearest 1,000%) come out to be 90,000%, 88,000%, and 69,000%, respectively.

The lesson here is simple. The opportunity to invest in great companies coupled with the magical power of compounding returns can make prescient and patient investors very rich.