On a unit basis, Apple Inc. (AAPL) - Get Reportclaimed just 13.6% of the Chinese smartphone market in 2015 and 9.6% in 2016, according to research firm IDC. Those numbers don't look that impressive until one remembers that:

    China still only has a per capita GDP of around $8,000.

    iPhone models sell at significant premiums to their U.S. prices in China due to local taxes.

    Apple was the only foreign smartphone maker to crack China's top 5 in either 2015 or 2016.

    In that context, the fact that Apple sold about 45 million iPhones in China last year, and (with the iPhone X's help) should sell well over 50 million next year, looks a whole lot more impressive. As does what Tesla Inc. (TSLA) - Get Report, which just confirmed plans to build a Shanghai car-assembly plant, has pulled off to date in the Chinese electric car market, when one considers local demographics, import tariffs and the competitive backdrop.

    Bloomberg New Energy Finance recently estimated that Tesla has 8.6% of China's booming electric car market on a unit basis. That's good for fourth place overall and makes Tesla the only non-Chinese firm to place in the top ten. Though some big U.S., European and Japanese automakers are pushing ahead with efforts to crack the Chinese EV market, for now local firms such as BAIC (25.4% estimated share), Berkshire Hathaway Inc.-backed (BRK.A) - Get Report BYD (15.6%) and Jiangling Motors dominate.

    To a large degree, of course, Tesla isn't competing against local EV makers but against foreign-made, gas-powered luxury cars. Tesla's Model S sedan and Model X crossover offer much better range, performance and cargo room than the most popular Chinese EVs -- not to mention features such as Autopilot and Supercharger network access -- but are also much costlier. Thanks in large part to a 25% import tariff and a 17% value-added tax (VAT), the Model S starts at over $100,000 in China, compared with $69,500 in the U.S.

    Much like Apple with the iPhone, the Model S and Model X have established Tesla as an aspirational foreign luxury brand in a field where local players dominate downmarket. The company's Chinese revenue tripled last year to about $1 billion (13% of Tesla' total revenue) on the back of an estimated 10,400 vehicle sales.

    The Model X is quite popular in China.

    Tesla's aggressive efforts to build out its Chinese Supercharger network have helped its cause -- it aims to have 1,000 local Supercharger stations by year's end -- as have its retail store openings in big Chinese cities and its creation of an adapter that lets Tesla cars access third-party charging stations. Beijing's all-out push to grow EV sales hasn't hurt, either.

    Though the government aims to phase them out by 2020, for now subsidies of up to several thousand dollars are more are available for Chinese EV purchasers. Subsidies are also provided for creating charging stations, and local governments can provide additional incentives such as the elimination of costly license plate fees. And in September, Beijing unveiled a cap-and-trade plan that requires automakers to buy credits or pay fines if they fail to hit aggressive 2019 and 2020 EV production targets.

    Bloomberg estimates that Chinese EV sales more than doubled last year to 283,000, and sees them rising to 378,000 this year (around 40% of global EV sales). But that's still a far cry from Beijing's ambitious (too ambitious?) 2025 production target of seven million electric vehicles.

    Tesla is betting that building an assembly plant in Shanghai's free trade zone will help it maintain a leading position in the high-end portion of this burgeoning market. Though cars made at the plant will still likely be subject to import tariffs, the facility would still lower Tesla's production and shipping costs. And (much like Apple's reliance on Chinese contract manufacturers), it would probably earn the company some goodwill with Beijing.

    Presumably Tesla's Model 3 sedan ($35,000 U.S. starting price) and low-cost Model Y crossover (due in the 2019/2020 timeframe) would be among the cars made at the Shanghai plant. As is the case elsewhere, the Model 3 stands to significantly increase Tesla's addressable market -- provided the company can pull off a giant production ramp. With Tesla still needing to work through a backlog of 455,000 Model 3 net reservations in the U.S., the company doesn't plan to start international Model 3 shipments until late 2018.

    As is the case for Apple, the swelling ranks of Chinese with large amounts of disposable income will aid Tesla's cause over the long run. Consulting firm McKinsey estimates 9% of Chinese urban households will have incomes of $34,000 or more by 2022, up from just 3% in 2012. Nine percent might not sound like a lot, but it's worth keeping in mind that China had an urban population of 730 million as of 2015.

    To be sure, Tesla will face tougher competition in the high-end EV market in time. BMW and Audi's planned electric car launches especially bear watching. But Tesla is very much a moving target, and its investments in things such as Autopilot, the Supercharger network and battery and powertrain technologies are nothing to scoff at.

    Provided Tesla can keep building on those investments and in time crank out large quantities of Model 3 and Y units at its planned Shanghai plant, China could be as much of a success story for Elon Musk's company as it has been for Apple.

    Apple is a holding in Jim Cramer'sAction Alerts PLUS Charitable Trust Portfolio. Want to be alerted before Cramer buys or sells AAPL? Learn more now.

    More of What's Trending on TheStreet: