The broad-based S&P 500 dropped into a bear market last year, as investor sentiment soured over rising interest rates and high inflation. But economic headwinds are ultimately a temporary problem, and history says the S&P 500 will recover when the next bull market rolls around. In fact, the benchmark index has never failed to recoup losses sustained during previous bear markets, and there is no reason to expect a different outcome this time around.

In the meantime, many great stocks are trading at very reasonable prices, and that creates an opportunity for patient investors. Here's why HubSpot (HUBS 2.96%) and Costco Wholesale (COST 1.01%) are worth buying today.

1. HubSpot is a leader in CRM software

HubSpot provides customer relationship management (CRM) software to small and medium-sized businesses (SMBs). Its platform is engineered to boost productivity across marketing, sales, service, and operations teams, helping SMBs attract leads, convert leads into paying customers, and delight those customers at every stage of the customer journey.

HubSpot pioneered inbound marketing, a strategy that replaces unsolicited ads with relevant web content meant to engage consumers at the right time. Traditional outbound marketing tactics tend to be irritating, but inbound marketing feels organic -- like a blog or website discovered through an internet search. HubSpot also employs a freemium pricing strategy, enabling businesses to graduate from free to paid products as they need more functionality.

That strategy is resonating in the market. HubSpot is the leader in CRM software for small businesses, and it ranks as the best global software seller in any category, according to research company G2. That prestigious placement is based on its strong market presence and high user satisfaction scores.

Economic headwinds weighed on HubSpot last year, but the company still turned in a strong performance in the fourth quarter. Revenue jumped 27% to $470 million, and non-GAAP earnings soared 91% to $1.11 per diluted share. As a caveat, management expects growth to slow in the current quarter, but HubSpot should have no problem regaining its momentum in a more favorable economic climate.

The company expects its addressable market to reach $72 billion by 2027, and HubSpot is developing new payments and commerce products that should make its CRM platform even more compelling. With shares trading at 11 times sales, a discount to the three-year average of 17.2 times sales, now is a great time to buy this growth stock.

2. Costco embodies retail excellence

Costco is a membership-based retailer that operates 848 warehouses around the globe, most of which are located in the U.S. and Canada. It currently ranks as the third-largest retailer in the world, and that success is built on a simple business model: Offer low prices on a limited number of brands across a broad range of goods, and count on that strategy to drive high sales and rapid inventory turnover.

Costco carefully evaluates products for quality, and it carries only 4,000 stock keeping units (SKUs) on its shelves, far less than the 30,000 SKUs at most supermarkets. That supercharges its already immense buying power by forcing brands to compete for limited shelf space. And in cases where name-brand products have become too expensive, Costco will undercut competitor pricing by making similar products through its Kirkland Signature private label. That often results in big cost savings for members, usually about 20%, and a higher profit margin for the company.

Costco reported lackluster results in the second quarter of fiscal 2023, ended Feb. 12. Store traffic and the average ticket price increased 5% and 0.2%, respectively, but e-commerce sales dropped nearly 10% as consumers pulled back on big purchases. In total, revenue increased 6% to $55 billion, and earnings climbed 13% to $3.30 per diluted share. For context, both of those figures decelerated sharply from the prior year, when revenue increased 16% and earnings jumped 36%. Investors should expect growth to decelerate further in the coming quarters as economic headwinds continue to weigh on the business.

However, Costco remains well positioned to create value for patient shareholders, especially in a more favorable economy. It reported a membership renewal rate of 92.6% in the second quarter, indicating that its business model inspires a high degree of customer loyalty. The company is working to build on that foundation by attracting new members, scaling its e-commerce business, and opening new warehouses.

Currently, shares trade at 35.4 times earnings. That valuation is not cheap by traditional standards, but it is a discount to the three-year average of 39.4 times earnings. It's also a reasonable price to pay given Costco's strong position in the retail industry. That's why investors should buy a few shares of this growth stock today.