US carmaker Tesla has hiked prices on its Model X and S cars by about 20% in China, becoming the first car maker to raise prices in the world's largest automotive market in response to a US-China trade war. 

The move is the first indication of how much higher Chinese tariffs on certain US imports will flow through to showroom floors.

Other car makers are likely to follow suit or shift a greater portion of production to China. 

China slapped retaliatory tariffs on US car imports in response to US President Donald Trump's move to impose tariffs on $34 billion worth of Chinese goods. 

China's tariffs are expected to hurt car makers as well as companies that make industrial components in the US, and produce soybean, whisky and other agricultural produce. 

For Tesla especially, rapidly burning cash and struggling to turn a profit, China is key. Sales in the country accounted for about 17% of its revenue last year. 

Analysts said that raising the prices is going to hurt sales, but money-losing Tesla has to raise prices because it can not afford to fully absorb the higher costs of the tariffs. 

In May Tesla slashed up to $14,000 off its Model X in China after Beijing announced major tariff cuts for imported automobiles, but the new tariffs have now erased that. 

A basic Model S salon now costs about 849,900 yuan ($128,779) up from 710,579 in May, while a Model X sport-utility vehicle costs about 927,200 yuan now, versus 775,579 yuan in May, according to its website.

Tesla's price increases come as it plans to build a factory in Shanghai to serve the Chinese market. The company ships more than 15,000 cars a year to China. 

Chief executive Elon Musk is expected to visit Shanghai today, Bloomberg reported, citing people familiar with the plans. 

Musk will also visit Beijing on Wednesday and Thursday, Bloomberg said, quoting one of the sources.

Analysts were divided on how much the price increases will bother Tesla's affluent buyers. 

They said that Tesla consumers are a unique group of rich people. They want more of a brand image and product experience, price is less of a concern for them. 

German luxury automaker BMW, which also makes cars in the US to sell in China, has also flagged that it will raise prices on vehicles it makes in Spartanburg, South Carolina.

It said on Friday that it was unable to "completely absorb" the new tariffs. 

Daimler, another German automaker which imports US-produced cars into China, said in a statement over the weekend that it "aims to maintain a competitive position" in China. 

Ford said last week it would not hike prices on its imported cars for now, crimping its profit margins.