Many economic experts (including members of the Federal Reserve) expect a mild recession this year, but patient investors have no reason to worry. In fact, history says now is a good time to buy growth stocks. The S&P 500 Growth index produced a total return of 635% over the last two decades, despite the occurrence of two recessions, outpacing the 561% return of the broader S&P 500 index.

Here are two growth stocks to buy now and hold for the long term.

HubSpot: A leader in customer relationship management software

HubSpot (HUBS -2.40%) provides customer relationship management (CRM) software to small and medium-sized businesses (SMBs). Its platform includes productivity tools for sales, service, marketing, and operations teams. It also includes solutions for content management and payments. As a whole, HubSpot's CRM suite helps businesses build and maintain lasting relationships with their customers by providing a delightful experience at every stage of the customer journey.

HubSpot competes with larger CRM vendors like Salesforce, but the company has still thrived due to its focus on the underserved SMB market. HubSpot has also taken a different tack with respect to product development. Whereas Salesforce has added features by acquiring other companies, HubSpot has leaned more heavily on internal product development, creating an easy-to-use CRM suite that is free of integration challenges.

HubSpot reported solid financial results in the first quarter. Its customer count climbed 23% to 177,000, and the average subscription revenue per customer ticked 3% higher. In turn, revenue increased 27% to $502 million and non-GAAP net income soared 122% to $1.20 per diluted share. i

Investors should expect that momentum to continue. CRM software plays a key role in helping businesses attract and retain customers, and HubSpot is the leading CRM vendor among small businesses. Even more impressive, research company G2 recently ranked HubSpot as the best global software seller of any kind based on its strong market presence and high user satisfaction scores.

On that note, HubSpot believes its total addressable market will reach $72 billion by 2027, leaving plenty of room for growth (and plenty of upside for investors). Yet, shares trade at 11.7 times sales, a sizable discount to the three-year average of 17.3 times sales. That's why this growth stock is worth buying today.

Datadog: A leader in observability software

Datadog (DDOG -1.43%) provides monitoring software for development, operations, and security teams. Its platform comprises over a dozen discrete products that give clients visibility across their IT environment, helping them keep their applications and infrastructure performant and secure. Datadog provides more than 600 prebuilt integrations that simplify deployment, and its artificial intelligence (AI) engine accelerates the resolution of problems by automating tasks like anomaly detection and root cause analysis.

Datadog has a strong market presence in several observability software verticals. Consultancy Gartner recognized the company as a leader in application performance monitoring and observability last year, and Forrester Research recognized its leadership in AI for IT operations. More recently, G2 named Datadog a leader in cloud infrastructure monitoring and server monitoring.

Datadog reported solid financial results in the first quarter, displaying an ability to onboard new customers and command loyalty even in a difficult economic environment. Its customer count climbed 29% to 25,500, and its net retention rate once again exceeded 130%, meaning the average customer spent at least 30% more over the past year. In turn, first-quarter revenue increased 33% to $482 million and non-GAAP net income jumped 17% to $0.28 per diluted share.

Looking ahead, digital transformation should be a tailwind for Datadog. Cloud migration is making IT environments more complex and more vulnerable to attack, creating a need for effective observability and security software. Datadog addresses both needs with a single platform, and management says its market opportunity will hit $62 billion by 2026.

Currently, shares trade at 13.5 times sales, an absolute bargain compared to the three-year average of 38.5 times sales. That's why this growth stock is worth buying today.