PRETORIA, May 15 (Reuters) - South Africa's President Cyril Ramaphosa signed into law on Wednesday a bill that aims to provide universal health coverage, although opponents say it is inadequately funded and will undermine the quality of care.

Ramaphosa has vowed to reform South Africa's two-tier health system, in which a publicly funded sector that serves 84% of the population is overburdened and run-down, while some people have access to better treatment through private insurance.

His signing of the National Health Insurance (NHI) bill, which was passed by parliament last year, comes two weeks before an election in which the ruling African National Congress is fighting to retain its parliamentary majority after 30 years in power.

The bill will gradually limit the role of private insurance, create a new public fund to provide free access for South African citizens, and set the fees and prices for products that private doctors and healthcare suppliers can charge for NHI-funded benefits.

Supporters call it a generational change to reverse persistent inequality dating to the apartheid era. But opponents say it will be a drain on already stretched public finances, limit patient choice and drive talented doctors out of the country.

The main opposition party, the Democratic Alliance, and some labour and business groups plan to challenge the bill in court. Industry and political analysts have said it is likely to get bogged down in lawsuits for years.

The government has said the National Treasury will determine the funding sources for NHI, which will include a mandatory pre-payment system and other forms of taxes.

Big local health insurers like Discovery, Momentum Metropolitan Health and AfroCentric say they support the goal of universal health coverage but they do not agree on the proposed funding model.

"There is no funding plan yet and given the country's constrained fiscal position, low economic growth and narrow tax base, this can only be solved in the longer term," said Adrian Gore, group CEO of Discovery.

"We see no scenario in which there is sufficient funding for a workable and comprehensive NHI in its current form."

(Reporting by Nqobile Dludla and Nellie Peyton; Editing by Emelia Sithole-Matarise)