By Sherilee Lakmidas and Jon Herskovitz

JOHANNESBURG (Reuters) - Workers have reached a deal with Anglo American Platinum to reinstate 12,000 miners sacked for an illegal strike, which could end the last big industrial action that has rocked South Africa's massive mining sector.

Months of often violent wildcat strikes have cut production in the platinum and gold sectors, raising concerns about slowing economic growth as well as awkward questions about President Jacob Zuma's management of the most damaging labor strife since the end of apartheid in 1994.

"They agreed to reinstate all the dismissed workers on the provision that they return to work by Tuesday," Lesiba Seshoka, spokesman for the powerful National Union of Mineworkers (NUM), told Reuters on Saturday.

Seshoka said he expected workers would return to their posts and "that will mean the end of the strike".

Anglo American Platinum, or Amplats, said in a separate statement it had reached the deal with several unions and offered sweeteners such as a one-off hardship payment of 2,000 rand ($230) to facilitate the return. The strike has lasted about six weeks and crippled production.

"Employees who do not return to work on Tuesday ... will remain dismissed and/or be subjected to the illegal strike disciplinary action and will not be eligible for any of the benefits mentioned above," it said in a statement.

While tensions may be winding down at Amplats mines, police in the area's platinum belt city of Rustenburg fired rubber bullets, tear gas and stun grenades at a labor rally on Saturday to separate NUM members from other workers who have been fighting a deadly turf war for support.

Seven people were arrested and no major injuries were reported in the incident about 120 km (80 miles) northwest of Johannesburg, police said.

In recent days, several wildcat strikes over wages and working conditions in the gold sector have come to an end with employers sacking, or threatening to sack, miners striking illegally.

South African labor law requires clear formal processes for strikes and walk-outs. Those that do not go through all the proper hoops are considered illegal, and can result in striking workers being sacked.

Mining firms usually reinstate dismissed workers because it is more expensive to train a new workforce. But some of the job losses could be permanent with employers using the labor strife to shut down marginal mines in South Africa.

ANC ELECTION

The deal at Amplats comes after Cynthia Carroll, chief executive of parent Anglo American, announced her resignation on Friday. She had come under pressure from investors over the firm's lagging share price and continued dependence on strike-hit South Africa.

Anglo owns 77 percent of Anglo American Platinum. Although responsible for 24 percent of its parent's 2011 revenue, Amplats brought in just 8 percent of total operating profit because of soaring costs.

If the workers do return to Amplats, Zuma will have likely weathered a labor storm that threatened to cause problems for him as he seeks re-election as leader of the ruling African National Congress at a party meeting in December.

If Zuma wins the race to lead the party that dominates South African politics, he will be on a path to remain the country's president for another term lasting until 2019.

Zuma has called on wildcat strikers to return to work, pledged to speed up a massive infrastructure program to improve living conditions in the mining belt and held a high-level meeting with labor and industry trying to break the impasse.

Critics saw these moves as mostly symbolic, doing little to ease the tension and saying hardball negotiation tactics from employers and weeks of lost wages had more of an effect in ending many of the strikes.

Local media said Zuma appeared to have an edge in the ANC race, in which about 4,500 local branch delegates will select the party's leaders. Zuma's foes, who see him as an ineffectual leader, could be emboldened if labor tensions flare again.

Many strikers accuse ANC leaders and their labor allies of worrying too much about their political ties and not showing enough concern for miners working deep underground.

The strikes have highlighted persistent glaring income inequality in South Africa, which has increased since Nelson Mandela's ANC took over following the end of white-minority rule in 1994, promising "a better life for all".

Zuma has come in for particular criticism for not responding faster to the August 16 police killing of 34 strikers at Lonmin's Marikana platinum mine, the bloodiest security incident since the end of white-minority rule in 1994.

(Editing by Andrew Roche)