"Your day will come. I applaud your resilience," Winfrey told a cheering crowd in Soweto. "I say there's no such thing as failure. Failure is just a mistake trying to move you in a better direction."
The philanthropist and former talk show host, who opened an academy for girls in South Africa a decade ago, acknowledged the high unemployment, poverty and other social challenges persisting in the country that held its first all-race elections in 1994 after the end of white minority rule.
But Winfrey, who said she was visiting South Africa for the 36th time, told young people not to give up. "Because it is your fresh perspectives that are going to bring about unprecedented innovation for this country. We need you."
The Nelson Mandela Foundation co-hosted the event, one of a series of activities honoring Mandela this year. The anti-apartheid leader and South Africa's first black president died in 2013 at age 95.
Winfrey said she stayed with Mandela and his wife Graca Machel for 10 days during one of her visits. Mandela spoke about his many years in prison during apartheid as well as his concern about the corrosive effect of poverty, she said.
"I loved him so and he was my favorite mentor because he was a man who could have sought revenge, but instead he sought reconciliation," Winfrey said. Mandela "could have crushed his opponents with his power. But instead he chose to defeat them without ever dishonoring them."
Machel, an advocate for women's and children's rights, joined Winfrey on the stage and also spoke about hardship. "We are a wounded society," Machel said, noting pervasive violence against women and children.
Follow Africa news at https://twitter.com/AP_Africa
Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.