Inflation soared to a four-decade high last year, pushing the Federal Reserve to implement its most aggressive series of rate hikes since the early 1980s. That sent the S&P 500 tumbling into a bear market, and the benchmark index is still 15% off its high.

But recent turmoil in the banking industry could further tighten lending conditions, adding to the downward pressure on economic growth and corporate profits. Those headwinds could drag the S&P 500 to new lows in the near term.

However, investors need to look further down the road. Every single bear market has eventually ended in a bull market, and there is no reason to expect a different outcome this time. That means the next bull market is almost certainly on its way. In the meantime, magnificent stocks like Amazon (AMZN 3.43%) and HubSpot (HUBS -0.78%) are trading at discounted prices, which creates a buying opportunity for patient investors.

Amazon: A key player in three growing markets

Amazon reported weak financial results last year as high inflation slowed sales and accelerated operating expenses. Revenue increased 9% to $514 billion, and cash from operations climbed 1% to $46.8 billion. But investors need to contextualize those metrics and consider the big picture.

Amazon doubled its fulfillment footprint in the last few years, and the company is now growing into excess capacity. That excess capacity reduced operating efficiency last year, and it will continue to hinder profitability in the near term. But a bigger logistics network will ultimately deepen the moat around its e-commerce business. Amazon already runs the most-visited online marketplace in the world, and its ability to provide fulfillment services to sellers (and fast delivery to buyers) reinforces the network effects inherent to its business.

More broadly, headwinds like high inflation and unfavorable foreign exchange rates will fade eventually, and Amazon is well positioned to reaccelerate growth as economic conditions improve. While the company is best known for its e-commerce business, Amazon is also the market leader in cloud infrastructure and platform services, and it ranks as the fourth-largest adtech company in the world. That portends better days ahead.

According to Grand View Research, cloud computing spend will climb at 14.1% annually through 2030, and the ad tech market will increase at 13.7% annually over the same period. Meanwhile, Ameco Research says global e-commerce sales will grow at 13.6% annually through 2030. In short, Amazon is a key player in three industries forecast to grow at a double-digit pace for many years.

Investors can reasonably assume those tailwinds will drive double-digit revenue growth for Amazon. That makes its current price-to-sales ratio of 2 look cheap, and it's certainly a discount to the five-year average of 3.6 times sales. That creates a compelling buying opportunity.

HubSpot: A leader in CRM software for small businesses

The customer relationship management (CRM) software market is expected to grow at 13.9% per year through 2030, reaching $163 billion, according to Grand View Research. HubSpot is well-positioned to benefit from that rising tide. Its CRM platform offers productivity software for marketing, sales, service, and operations teams, as well as content management and payments tools. Those solutions help businesses attract leads with engaging websites, convert those leads into paying customers, and maintain strong customer relationships over time.

HubSpot is far from the largest player in the CRM space -- that title belongs to Salesforce -- but it has carved out its own niche by catering to the needs of small businesses. Its freemium pricing model and tiered product offering lends itself to a land-and-expand growth strategy, and that approach is paying off.

HubSpot's customer count increased 24% to 167,300 over the past year, and the average subscription revenue per customer increased by 3%, indicating that businesses are adopting more products and graduating to higher product tiers. In turn, revenue climbed 33% to $1.7 billion, and non-GAAP (generally accepted accounting principles) earnings soared 53% to $2.78 per diluted share.

Since 2006, HubSpot has grown from a marketing software vendor to a full CRM provider, and the company is still strategically building out its platform. For instance, it launched HubSpot Payments last October, a service that streamlines business-to-business commerce by integrating payments functionality into its CRM suite. Continuous product development should keep HubSpot at the forefront of the industry.

HubSpot is already the CRM market leader among small businesses, outpacing its peers in both market presence and user satisfaction, according to research company G2. That success should snowball as HubSpot continues to innovate and push upmarket.

With that in mind, shares currently trade at 11.9 times sales, a discount to the three-year average of 17.2 times sales. Investors should buy a small position in this growth stock at that price.