My investing strategy has always been to buy a stock and plan to hold it for decades. In some cases, parting ways with a stock is needed if the business fundamentally changes for the worse, but for the most part, the real value comes over the long run.
Buying shares with the intention of holding them makes it easier to accept the inevitable ups and downs and focus on the long-term value you'll (ideally) receive from them. Letting time and compound earnings do the heavy lifting is one of the surest ways to build wealth in the stock market.
With $5,000 to invest (or any amount, really), I would put it into the following two companies and not look back. They operate in different industries, but are both poised to continue being great businesses for the long haul.

Image source: Getty Images.
1. Amazon
Amazon (AMZN 1.81%) has been one of the premier growth stocks over the past 20 years, up around 11,600% compared to the S&P 500's 400% gains over that span.
Although Amazon is undoubtedly known for its bustling e-commerce business, it has evolved into one of tech's most thorough conglomerates. The once-humble online bookseller has now ventured into e-commerce, cloud computing, media and entertainment, and advertising.
E-commerce continues to be a massive moneymaker, with its North America and International segments combining for over $126 billion in sales in the first quarter -- this includes subscription revenue, third-party sellers, and more.
For perspective, that's more than AT&T made in its last four quarters combined, and nearly double Amazon's total revenue just six years ago.
AMZN Revenue (Quarterly) data by YCharts.
Having e-commerce as the engine that fuels other business ventures has allowed the company to invest heavily in high-growth segments and focus on innovation. The one that has benefited the most is its cloud service, Amazon Web Services (AWS).
AWS is the world's largest cloud platform and has been a major growth driver over the past decade. So much so that as a stand-alone company, AWS would easily be one of the top 100 revenue-generating public companies in the world.
It will continue to be Amazon's profit maker, but other segments, such as Amazon Prime, its various healthcare ventures, advertising, and its logistics network offer significant long-term upside.
Amazon has become one of the best companies at diversifying its business and revenue streams, better prepping it to withstand whatever economic conditions come its way. If you're looking for a stock to hold for the long haul, that's one quality you want to look for.
2. Visa
Visa (V 0.65%) is a stock that I've committed to consistently buying because it's arguably the most important company in the global payments ecosystem. And it has become that by simply playing middleman, connecting consumers, businesses, and banks.
As of the beginning of this year, Visa had 4.8 billion payment credentials (cards, digital wallets, etc.), was accepted by over 150 million merchants, and issued cards for around 14,500 financial institutions. That's a large reach that even its next closest competitor, Mastercard, won't be able to touch for quite a while.
Since Visa operates only the payment network and doesn't issue cards or offer credit, its business is able to operate with high margins and minimal credit risk. If you own a Chase credit card in Visa's network and decide not to pay your balance, you owe Chase, not Visa.
Operating as a high-margin, relatively low-risk business has given it the free cash flow it needs to continue expanding its payment network and investing in other financial innovations.
Visa receives a boost with the payment network due to the network effect. It is the most widely accepted card, so people prefer to own its cards; and it's the most widely owned card, so businesses prefer to accept Visa.
V Free Cash Flow (Quarterly) data by YCharts.
Network effects aside, it's essential that the company maintains an innovative mindset because the payments landscape is rapidly changing with the introduction of new technologies.
Luckily, Visa has shown that it's not in the business of complacency, which is what you want from the industry leader and the stock you plan to hold on to for the long haul.