South Africa has one of the continent's biggest and most developed economies.
Up until 1994 it was ruled by a white minority government, which enforced a separation of races with its policy called apartheid.
The apartheid government eventually negotiated itself out of power after decades of international isolation, armed opposition and mass protests.
The democratically-elected leadership encouraged reconciliation and set about redressing social imbalances, but the economy has struggled.
President: Cyril Ramaphosa
Cyril Ramaphosa was elected president by parliament in February 2018 after his predecessor, Jacob Zuma, resigned over corruption allegations.
A successful but sometimes controversial businessman, Mr Ramaphosa was picked as leader of the governing African National Congress (ANC) a few months earlier.
He inherited a struggling economy, a divided party, and the problem of entrenched corruption.
Unlike many senior party figures of his generation, Mr Ramaphosa was not driven into exile for opposing apartheid.
He fought the injustices of white minority rule from within South Africa, most prominently by defending the rights of black miners as leader of the National Union of Mineworkers (NUM).
He was heavily involved in the talks to end apartheid, and played an important role in the drafting of South Africa's post-apartheid constitution.
After missing out on becoming then President Nelson Mandela's deputy, Mr Ramaphosa withdrew from active political life, switching focus to business.
He returned as deputy president in 2014, before finally taking the top job from the scandal-plagued Mr Zuma. He passed his first test when the ANC won the May 2019 parliamentary elections, although its 58% share of the vote was its lowest margin of victory since the end of apartheid.
South Africa is the continent's major media player, and its broadcasters and press reflect the diversity of its people.
Established state-run and commercial TV broadcast nationally, and hundreds of thousands of viewers subscribe to satellite and cable. South Africa-based MultiChoice markets satellite pay-TV in dozens of African countries.
Some key events in South Africa's history:
1910 - Formation of Union of South Africa by former British colonies of the Cape and Natal, and the Boer republics of Transvaal, and Orange Free State.
1912 - Native National Congress founded, later renamed the African National Congress (ANC).
1948 - Policy of apartheid (separateness) is adopted when National Party (NP) takes power.
1960 - Seventy black demonstrators killed at Sharpeville. ANC banned.
1976 - More than 600 killed in clashes between black protesters and security forces during uprising which starts in Soweto. The challenge to white rule escalates over the years.
1991-1994 - Negotiated end to apartheid leads to first non-racial elections and formation of a Government of National Unity under Nelson Mandela.
2009 May - Parliament elects Jacob Zuma as president. He resigns in 2018 over corruption charges.