If you have a long investing time horizon, growth stocks offer a tantalizing way to build wealth. Although the market has been hit with fears about a slowing economy, and the S&P 500 fell into bear market territory briefly last week, those who have patience will undoubtedly benefit financially by investing in growth companies.

Two such companies, Amazon (AMZN -2.56%) and Texas Roadhouse (TXRH 0.18%), have seen their share prices fall by 36% and 16%, respectively, since the start of 2022. However, these two growth stocks still have strong long-term prospects.

It's time to uncover why buy-and-hold investors will find these stocks have the potential for outsized gains in the next decade.

Two people looking at a stock chart on a monitor.

Image source: Getty Images.

1. Amazon

There's no arguing that Amazon's stock has gotten off to a rough start this year. Aside from the overall market malaise, investors didn't like the company's recent quarterly loss.

In the first quarter, Amazon lost $3.8 billion, compared to an $8.1 billion profit a year ago. But this year's period includes a $7.6 billion loss on its investment in Rivian Automotive. Operating income, a better measure of Amazon's core business, was $3.7 billion, down from $8.9 billion.

While the decline in operating income isn't great, I have reasons to believe that it's a short-term phenomenon. Management has been contending with higher costs for increased staffing and storage capacity as it was dealing with surging demand. However, it now pledges to focus on efficiency and productivity.

Additionally, while its North American and International segments generate most of Amazon's sales, its high-margin Amazon Web Services (AWS) typically account for most of the company's operating profit. And in the latest quarter, the segment had a $6.5 billion profit, while the other two businesses produced losses.

AWS has the largest market share, 32%, in the fast-growing cloud-computing sector. Better still, due to the large commitment needed for data centers, there are significant barriers to entry. The other major competitors are Alphabet and Microsoft's Azure.

The business continues to perform well, For the first quarter, AWS's sales grew by 36.6% to $18.4 billion, driving its operating income 56.6% higher. With companies clamoring for data, a slowdown doesn't appear to be in sight.

Its other businesses may face certain short-term strains from higher costs, but online sales will continue proliferating. With Amazon's dominant position, along with its popular Prime subscription service, the company should soon operate on all cylinders.

2. Texas Roadhouse

Although investors have become concerned about a potential recession, Texas Roadhouse's results certainly didn't betray any signs that the economy's slowing down. In the first quarter, same-store sales (comps) increased by 16% at company-owned restaurants and 20.4% at domestic franchised locations.

However, like many others in the sector, profitability was hurt by higher food and labor costs. The restaurant's operating margin contracted by about 2.1 percentage points to 16.4%. For the year, management expects positive comps. Although it anticipates commodity costs increasing by 12% to 14% and labor by 7%, it implemented a price increase last month that should offset some of these expenses.

Certainly, an economic slowdown would cause fewer people to eat out. But right now, the economy's humming along, and unemployment remains at a low 3.6%.

And management continues to open new restaurants. This year, it expects to open 25 Texas Roadhouses and 33 locations of Bubba's. The company ended 2021 with 667 restaurants, an increase of 33 from the previous year. About 94% are Texas Roadhouse restaurants.

Offering quality food at decent prices has proven successful over the years. This simple concept has allowed Texas Roadhouse to expand profitability, and there's still room to open more restaurants. That makes the company a rare gem in the competitive restaurant industry.

Looking at the numbers

Investing in growth stocks often means paying high price-to-earnings (P/E) multiples. But Amazon's P/E is 51.3, well below the over 80 times it traded at in April. Texas Roadhouse's P/E is 20.43, down from the 26 multiple the stock sold at in March.

Hence, these two stocks not only offer solid long-term growth prospects, but you also have an opportunity to buy them at a discount. That's a powerful combination that doesn't come along often.