SHANGHAI— Suzuki Motor Corp. 7269 -3.60% said it is quitting the China market, as foreign makers of mass-market cars come under mounting pressure from Chinese rivals.

The decision was also driven by changing tastes among Chinese buyers, who have moved away from the compact cars that Suzuki builds in favor of sports utility vehicles.

“Approximately 25 years ago, we launched the Alto in China, and since then we have made efforts in cultivating the Chinese market,” said company chairman Osamu Suzuki in a statement confirming the sale of Suzuki’s 50% stake in its Chinese joint venture to its partner, state-run Chongqing Chang’an Automobile Co.

“However, due partly to shifting of Chinese market to larger vehicles, we have decided to transfer all equity to Chang’an Automobile,” Mr. Suzuki said.

Suzuki sold more than 266,000 cars in China in 2014, according to LMC Automotive, but last year sales dwindled to around 119,000 vehicles, as market conditions in China – the world’s largest auto market – grew increasingly tough for weaker foreign brands.

“Suzuki was too slow to meet customers’ demands for model updates,” said Jeff Cai, general manager of vehicle quality at JD Power China. “There were no new models launched while competitors, especially domestic brands, launched several.”

Quitting China will enable the company to concentrate on the Indian market, where it is the top-selling auto maker through its local joint venture Maruti Suzuki India Ltd.

Though the China market has been growing overall, the strides made by Chinese auto makers—which now dominate budget sales and are encroaching into mid-price segments once controlled by foreign brands —mean Suzuki may not be the last foreign auto maker to give up on China, analysts say.

“We have seen other international auto makers suffer from increased competition from the improved quality of local brands,” said Janet Lewis, MacquarieCapital Research’s managing director of equity research. “These include Hyundai/Kia, Peugeot, Citroen, Chevrolet and Ford.”

Ford Motor Co. ’s sales in China fell 25% in the first half of 2018, as the company struggled to refresh its product line-up quickly enough to keep pace with China’s fast-moving market. European and Korean brands have also been losing market share.

Fiat Chrysler Automobiles Co. recently withdrew its Fiat brand—like Suzuki a compact-car specialist—from the China market.

Chang’an will continue to build Suzuki-branded cars under license, the company said. Suzuki dissolved its other Chinese joint venture with Jiangxi Change Automobile Co. earlier this year.

The path to survival for mass-market foreign auto makers is to invest and try to move their brand upmarket, said Ms. Lewis, rather than try to compete with bargain Chinese brands head-on. “To avoid being squeezed, you have to maintain a premium product,” she said.

Write to Trefor Moss at Trefor.Moss@wsj.com