We aren't quite halfway through 2023, and the stock market is as dynamic as ever. Interest rates, inflation, and a looming recession are making headlines, but so should technology, performance, ingenuity, and growth.

Investing is a terrific idea if you have $5,000 in cash available to invest, whether it's been sitting for years or from an unexpected windfall. There's no best time to invest in the market -- predicting short-term movements is too hard (just ask pros like Warren Buffett and Charlie Munger).

Instead, investors should focus on acquiring excellent companies with secular growth tailwinds to hold for years. Visa (V 0.63%) and Amazon (AMZN 0.23%) stocks look compelling now for myriad reasons. Let's take a look.

Visa is undervalued historically

Visa, along with Mastercard, effectively form a duopoly in the payment-processing market. A recent study shows that Visa (53%) and Mastercard (32%) make up 85% of credit cards. They also account for 72% of purchase dollars, with Visa accounting for over 50%. Mastercard is also a terrific company, but Visa's market share is superior. The companies provide the services (authorization, clearing, and settlement) that make credit card transactions go smoothly and earn revenue by taking a percentage of each transaction. The business model is great for shareholders now for several reasons.

First, society is increasingly cashless, so credit card sales will continue to increase. Next, Visa's service business is extremely profitable, consistently generating an operating margin above 60%. Finally, the company is inflation resistant. Since Visa takes a percentage of transactions, when prices go up, so does its revenue.

Visa's Q2 fiscal 2023 results were impressive, as usual. Revenue increased 11% year over year (YOY) to $8 billion, and net income increased 17% to $4.3 billion. Visa generated $8 billion in cash flow from operations for the first six months of the fiscal year.

Visa uses the cash to pay a rising dividend (14-year growth streak) and buy back its stock. So far in fiscal 2023, it has made $5.3 billion in stock buybacks and $1.9 billion in dividend payments. The dividend yield is small at less than 1%, but shareholders own Visa more for capital appreciation, and the rising dividend is a cherry on top.

The challenging economy allows investors to purchase Visa stock at enticing valuations. The chart below shows that the stock trades well below its recent average price-to-earnings (P/E) ratio and price-to-free-cash-flow ratio.

V PE Ratio Chart

V PE Ratio data by YCharts.

Buying a high-quality company at a low valuation is a ticket to long-term stock market success.

Amazon is making a comeback

Amazon lately has taken a battering from the economy and heat from investors. Everything but the kitchen sink has been thrown at it, like labor shortages, inflation, and rock-bottom consumer sentiment. Now, other businesses are becoming more conscious of data costs, and Amazon Web Services (AWS) growth is slowing. But don't count this stock out just yet.

Amazon's Q1 2023 results were quite impressive, especially given economic headwinds. Sales grew 9% to $127 billion, and operating income rose 30% to $4.8 billion year over year.

Net income also returned to positive territory at $3.2 billion, compared to a loss of $3.8 billion the prior year, and cash-flow metrics improved across the board. These results are a testament to the company's resilience.

The stock trades 37% off its all-time highs and at a price-to-sales (P/S) ratio not seen in years.

AMZN PS Ratio Chart

AMZN PS Ratio data by YCharts.

The big question investors must ask is whether Amazon will fight through current challenges and return to its recent glory. With over 200 million Prime members, the global cloud services leader (AWS), a dominant hold on the U.S. e-commerce market, and other initiatives, a resurgence is in the cards. This makes Amazon another intelligent growth stock for long-term investors. 

Wondering which company to invest in? Visa is best for investors who prefer something less risky with a rising dividend. Amazon probably has more potential for capital gains over time but will be more volatile and pays no dividend. Or you can split the investment and get the best of both worlds. 

As major players in massive growth industries that trade below historical valuations, Visa and Amazon look like excellent long-term growth-stock pickups.