JOHANNESBURG (Reuters) - South African retailer Massmart's MSMJ.J shareholders have accepted a takeover by U.S. group Wal-Mart WMT.N, setting up the world's largest retailer for a potential battle with local unions.

Massmart shareholders met on Monday to vote on the $2.3 billion offer. More than 97 percent of those present approved the deal, bringing total shareholder approval to nearly 79 percent, according to chairman Mark Lamberti.

COSATU, South Africa’s largest labor federation, threatened the “mother of all boycotts” in opposition to the deal.

While Wal-Mart has long tussled with organized labor in the United States, unions wield enormous power over South African politics and the economy.

“If the deal goes through, COSATU will do what it does best. We will organize the mother of all boycotts against Massmart,” COSATU’s first deputy president, Tyotyo James, told shareholders immediately before the vote.

Wal-Mart has said it will honor Massmart’s agreements with unions and that South African management would be retained.

Analysts have said keeping local expertise would be critical to avoid a bruising fight with unions. COSATU is in a governing alliance with the ruling ANC and wields enormous power.

“The union can muster support for the boycott but if they sustain the industrial action, I think that’s a little bit over the top,” Syd Vianello, analyst at Nedcor Securities.

“Massmart runs some of the cheapest stores so even if they can get some support in the beginning, I think common sense will prevail over some fundamental issues.”

The South African Commercial, Catering and Allied Workers Union (SACCAWU), a COSATU affiliate, has formed an “Anti-Walmart Coalition” that plans to ask South Africa’s competition watchdog to block the deal or attach tough conditions.

The coalition wants to keep existing labor and supplier agreements, among other things.