The former president and Nobel Peace Prize laureate had been frail and ailing for nearly a year with a recurring lung illness that dated back to the 27 years he spent in apartheid jails, including the notorious Robben Island penal colony.
But while his passing had been long expected, President Jacob Zuma's announcement of the death late on Thursday shook South Africa. The streets of the capital Pretoria and of Johannesburg were hushed, and in bars and nightclubs, music was turned off as people gathered to quietly talk about the news.
A somber Zuma told the nation in a televised address that Mandela "passed on peacefully in the company of his family around 20h50 on the 5th of December 2013".
"He is now resting. He is now at peace," Zuma said.
Tributes began flooding in almost immediately for a man who was a global symbol of struggle against injustice and of racial reconciliation.
U.S. President Barack Obama said the world had lost "one of the most influential, courageous and profoundly good human beings that any of us will share time with on this earth".
UK Prime Minister David Cameron called Mandela "a hero of our time". "A great light has gone out in the world," he said.
Praise also came from African leaders. Nigerian President Goodluck Jonathan said the death "will create a huge vacuum that will be difficult to fill in our continent".
Ordinary South Africans were in shock. "It feels like it's my father who has died. He was such a good man, who had good values the nation could look up to. He was a role model unlike our leaders of today," said Annah Khokhozela, 37, a nanny, speaking in Johannesburg.
Outside Mandela's old house in Vilakazi Street, Soweto, a crowd of people, some with South African flags draped around them, gathered to sing songs in praise of the revered statesman. "Mandela you brought us peace" was one of the songs.
"I have mixed feelings. I am happy that he is resting, but I am also sad to see him go," said Molebogeng Ntheledi, 45, reflecting the mix of reverence and resignation with which South Africans had been following Mandela's fight against illness.
National figures were quick to play down fears expressed by a minority that the passing of the great conciliator might lead again to a return of the racial and political tensions that racked South Africa during the apartheid era.
"To suggest that South Africa might go up in flames - as some have predicted - is to discredit South Africans and Madiba's legacy," another veteran anti-apartheid leader, former Archbishop of Cape Town Desmond Tutu, said. "Madiba" is Mandela's clan name.
"The sun will rise tomorrow, and the next day and the next ... It may not appear as bright as yesterday, but life will carry on," Tutu said in a statement of tribute.
SOUTH AFRICA "LOST A FATHER"
In his broadcast, Zuma ordered flags to be flown at half mast and said there would be a full state funeral for South Africa's first black president, who emerged from 27 years in apartheid prisons to help guide Africa's biggest economy through bloodshed and turmoil to democracy.
"Our people have lost a father. Although we knew this day was going to come, nothing can diminish our sense of a profound and enduring loss," the president said.
The U.N. Security Council was in session when the ambassadors received the news of Mandela's death. They stopped their meeting and stood for a minute's silence.
"Nelson Mandela was a giant for justice and a down-to-earth human inspiration," U.N. Secretary-General Ban Ki-moon told reporters. "Nelson Mandela showed what is possible for our world and within each one of us if we believe, dream and work together for justice and humanity."
Obama, the first black American president, described Mandela as an inspiration: "Like so many around the globe, I cannot fully imagine my own life without the example that Nelson Mandela set, and so long as I live I will do what I can to learn from him," he said in a televised address at the White House.
Mandela rose from rural obscurity to challenge the might of white minority apartheid government - a struggle that gave the 20th century one of its most respected and loved figures.
He was among the first to advocate armed resistance to apartheid in 1960 but was quick to preach reconciliation and forgiveness when the country's white minority began easing its grip on power 30 years later.
LEGACY OF PEACE
Former comrades and foes were united in their praise for Mandela, who was elected president in landmark all-race elections in 1994 after helping to steer the race-divided country towards reconciliation and away from civil war.
"Although we were political opponents - and although our relationship was often stormy - we were always able to come together at critical moments to resolve the many crises that arose during the negotiation process," said F.W. de Klerk, the white Afrikaner president who released Mandela in 1990.
South Africa's ruling African National Congress (ANC) party said the country and the world had lost "a colossus".
Mandela was awarded the Nobel Peace Prize in 1993, an honor he shared with de Klerk.
As president, Mandela faced the task of forging a new nation from the racial injustices left over from apartheid, making reconciliation the theme of his time in office.
De Klerk said in an interview with the BBC: "His greatest legacy is that we are basically at peace with each other".
The hallmark of Mandela's mission was the Truth and Reconciliation Commission which probed apartheid crimes on both sides of the struggle and tried to heal the country's wounds. It provided a model for other countries torn by civil strife.
In 1999, Mandela handed over power to younger leaders better equipped to manage a modern economy - a rare voluntary departure from power cited as an example to African leaders.
This made him an exception on a continent with a bloody history of long-serving autocrats and violent coups.
"Among Mandela's many legacies is his successful transition from guerrilla commander to true president," the U.S.-based risk consultancy Stratfor said in a note on the death.
In retirement, Mandela shifted his energies to battling South Africa's AIDS crisis, a struggle that became personal when he lost his only surviving son to the disease in 2005.
Mandela's last major appearance on the global stage came in 2010 when he attended the championship match of the soccer World Cup hosted by South Africa, where he received a thunderous ovation.
Charged with capital offences in the infamous 1963 Rivonia Trial, his statement from the dock was his political testimony.
"During my lifetime I have dedicated myself to this struggle of the African people. I have fought against white domination, and I have fought against black domination."