Costco Wholesale (COST 1.01%) is trading at close to 50 times its trailing earnings. Although not near its 52-week high anymore, the stock still looks expensive given its level of profitability. During the past 12 months, Costco shares surged 50%, soaring past the S&P 500 and its 32% gains over that time frame.

But despite its high price tag, there are still many reasons for investors to remain bullish on the stock both for this year and the long haul. Here's why Costco stock can be a great buy, even at its seemingly high valuation.

1. The business is still showing strong member growth

Revenue growth is important for businesses, but for Costco, membership growth may be even more crucial. Those are the customers who are signing up for one of its memberships and who are planning to spend at its warehouses on a regular basis. And with a high renewal rate, normally around 90% or better, odds are any new members are going to be customers for a long time.

On the company's most recent earnings call, which was for the fiscal second quarter (ended Feb. 18), management said the number of paid household memberships rose by 7.8% year over year. Costco now has 73.4 million paid household members and 132 million cardholders. It's an encouraging sign that even amid inflation and as budgets tighten up, consumers are seeing enough value in Costco's membership to sign up. That bodes well for the company's growth prospects this year and beyond.

2. Gross margin improved

Costco's business has proven resilient, yet again, as the company's gross margin was well protected. Last quarter, the company reported that its gross profit margin was up by 8 basis points compared to a year earlier. And even when factoring out gas deflation, gross margin was still higher by 4 basis points.

While those aren't huge improvements in the grand scheme of things (10.8% versus 10.72%), for retailers with thin margins and where cost control is crucial, this too is an encouraging sign that the company should be able to grow its profits. As its member count increases and the company isn't having to sacrifice gross margin for the sake of growth, Costco's bottom line should continue to increase, which means that a high price-to-earnings multiple could come down in the future.

3. Costco is opening more stores

In the current fiscal year, Costco expects to open 30 new stores, with two being relocations. While many of its new locations will be in the U.S., Costco is also launching new stores in Asia, including Japan, Korea, and China. The company said there were 10,000 people at the opening of its sixth store in China.

The strong demand in China is an exciting indicator of the long-term potential Costco has in that market. With just six stores, China is an almost untapped market for the big-box retailer. Costco still has plenty of growth opportunities in the long run, which is what makes it an incredibly attractive long-term buy.

4. The e-commerce business is another big opportunity for Costco

In Q2, Costco reported 5.6% comparable sales growth. But what really stood out was e-commerce, where comparable sales were up 18.4% year over year. E-commerce is another area where Costco is just scratching the surface in terms of potential, as is evident with that much faster growth rate. The company also says it recently rolled out Apple Pay as a payment option online to all of its members, which can facilitate the buying process and appeal to a wider range of customers.

Costco stock may be expensive, but it can still make for a solid investment

Costco's stock comes at a premium but odds are, this isn't going to be a stock that trades at 20 times earnings anytime soon. The danger for long-term investors is that if you wait too long for it to come down significantly in value, you might miss out on gains. If you're looking for a growth stock to buy and hold for the long haul, Costco can be a terrific investment to add to your portfolio.