Tesla Model 3 vehicles are loaded onto a truck for transport at the company's manufacturing facility in Fremont, California, on Wednesday, June 20, 2018.

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

The move is also the first indication of how much higher Chinese tariffs on certain U.S. imports will flow through to showroom floors, with other automakers likely to follow suit or shift a greater portion of production to China.

The tariffs will dent margins at Tesla and other automakers who make cars in the United States and ship to China, as they have been increasingly betting on the world's largest automotive market to boost profits.

"Raising the prices is going to hurt sales, but money-losing Tesla has to raise prices because they can't afford to fully absorb the higher costs of the tariffs," CFRA research analyst Efraim Levy said.

"Considering they claim to be capacity-constrained, they should be able to shift sales elsewhere."

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

In May it 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 sedan 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.

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

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