CAPE TOWN, South Africa – The African National Congress and its largest rival, the white-led, pro-business Democratic Alliance, agreed on Friday to work together in South Africa’s new government of national unity, a step change after 30 years of ANC rule.

Once unthinkable, the accord allowed President Cyril Ramaphosa to win a second term in office. He was re-elected by lawmakers with 283 votes.

The deal between two sharply antagonistic parties is the most momentous political shift in South Africa since Nelson Mandela led the ANC to victory in the 1994 election that marked the end of apartheid.

“It will once again be a privilege and pleasure to serve this great nation … (as) president,” the 71-year-old leader said in a speech to parliament, describing the coming government as an era of hope and inclusivity.

“That a number of parties that had opposed each other… have decided to work together to deliver this result has given a new birth, a new era to our country,” he said.

The ANC lost its majority for the first time in an election on May 29 and spent two weeks in talks with other parties that went down to the wire on Friday morning as the new parliament was convening in Cape Town.

“Today is a historic day for our country,” DA leader John Steenhuisen said.

“And I think it is the start of a new chapter … of us putting our country, … its interests and its future first.”

The National Assembly had earlier elected a DA lawmaker as deputy speaker, after choosing an ANC politician as speaker – the first concrete instance of power sharing between the two parties.

Long seen as unbeatable in national elections, the ANC lost support in recent years as voters wearied of persistently high levels of poverty, inequality and crime, rolling power cuts and corruption in party ranks.