Hyundai's first factory in its home country in more than two decades comes as the carmaker faces excess global capacity amid sluggish domestic demand, falling exports to the United States and weak sales in China.

Gwangju city council approved on Wednesday a revised plan for the joint venture, 19-percent owned by Hyundai, to build mini-SUVs from the second half of 2021.

President Moon Jae-in has made job creation a top priority since unemployment rates hit a 17-year high last year.

Moon, who attended Thursday's signing ceremony in Gwangju, had urged Hyundai to build a factory in the city that is a stronghold of his ruling party.

"Hyundai Motor decided to invest in this new joint venture in order to target the economy car market the company has not yet entered domestically," the carmaker said in a statement.

The union representing Hyundai workers has vowed to "fight strongly" against the joint venture, accusing the Moon government and Hyundai of only creating low-paying jobs.

Union leaders, who protested at Gwangju city hall on Thursday, said the joint venture would put downward pressure on wages, and eventually take away production and jobs.

A preliminary agreement reached last month included an annual wage of 35 million won ($31,341) for JV employees, less than half the average 92 million won paid to unionized Hyundai workers.

Labour representatives on the city council called for a revision to certain terms that would allow the JV to skip wage talks with its workers until production reached a total of 350,000 units. Hyundai rejected that proposal.

The city and Hyundai then agreed on a compromise plan for collective wage bargaining, the city said, making it possible for the JV and unions to negotiate terms in the event that the factory outperforms before reaching the threshold of 350,000 units.

Hyundai aims to start building mini-SUVs from 2021, with an annual capacity of 100,000 vehicles.

Hyundai has not opened a new production facility in South Korea - home to high-wage, strike-prone workers - since a factory in the central city of Asan in 1996.

The company has focused on establishing overseas production units, including in the world's largest auto market China, in a search for cheaper labour and to be closer to consumers.

(Reporting by Hyunjoo Jin and Ju-min Park; Editing by Himani Sarkar and Darren Schuettler)

By Hyunjoo Jin and Ju-min Park