HONG KONG — Tesla Motors is in discussions to establish a factory in Shanghai, its first in China, a move that could bolster its efforts in one of its major markets even as it further lifts China’s position as a builder of electric cars.

In a statement on Thursday, Tesla said it needed to set up more overseas factories to make cars that customers could afford. Such a strategy is a must in China, which charges steep tariffs for imported cars.

“Tesla is working with the Shanghai Municipal Government to explore the possibility of establishing a manufacturing facility in the region to serve the Chinese market,” a company spokesman said. “Tesla is deeply committed to the Chinese market, and we continue to evaluate potential manufacturing sites around the globe to serve the local markets.”

“While we expect most of our production to remain in the U.S., we do need to establish local factories to ensure affordability for the markets they serve,” the spokesman said.