Electric carmaker Tesla has signed an agreement with Chinese authorities to build a factory in Shanghai.

The "Gigafactory" would be Tesla's first outside of the US.

It intends to be producing 500,000 vehicles within five years of construction, which is due to start in the "near future", the company said in a statement.

The move will not have any impact on its US manufacturing operations, it said.

The announcement comes after the US carmaker raised prices on some of its cars by about 20% in China, according to media reports earlier this week.

Last week, the US slapped tariffs on $34bn worth of Chinese products, while China imposed retaliatory tariffs on several US goods, including cars.

The trade dispute between the two economic giants escalated further on Wednesday, after the US listed $200bn worth of additional products that it plans to tax as early as September.

"Shanghai will be the location for the first Gigafactory outside the United States. It will be a state-of-the-art vehicle factory and a role model for sustainability. We hope it will be completed very soon," Tesla chief Elon Musk said.

The company has faced some difficulties recently. At the same time, US carmakers in general have faced pressure to keep manufacturing jobs in the US.

The electric carmaker posted a record quarterly loss of almost $710m for the three months to March - more than double the same period last year - adding to concerns about its financial viability.