Costco has a problem in China, but it has nothing to do with tariffs, CNBC's Jim Cramer said Friday.e problem is Shanghai, a city of nearly 25 million people, has only one Costco store, the "Mad Money" host said.

Pair it with Costco's ability to deftly handle tariffs in the U.S.-China trade war, and it "sounds to me like a terrific investment thesis for owning Costco's stock for years and years to come," Cramer said.

When the wholesale chain opened its Shanghai store in August, overwhelming crowds forced it to shut down early. Signs near the store warned there may be a three-hour wait to park.

Costco's initial entrance into the Chinese market came in 2014, when it opened an online store on Alibaba Groups' Tmall online marketplace, according to Reuters.

But the massive success of the Shanghai store proves the staying power of Costco's business model, Cramer said. The shocking visuals from the store's opening day also foretold success in membership sign-ups, he said, noting that Costco CFO Richard Galanti recently indicated the location has more than 200,000 members.

Costco's locations in other Asian countries have around 100,000 to 120,000 after a few years, Galanti said.

Galanti's comments came on Costco's earnings call Thursday, after the Issaquah, Washington-based company issued its latest earnings report. Shares of Costco, one of the U.S.' largest retailers by sales, traded down 1.8% Friday, closing the session at $291.87.

Costco earned $1.73 per share, surpassing analyst forecasts of $1.72, according to IBES data from Refinitiv.