Jacques Kallis will retire from Test and first-class cricket after South Africa's forthcoming second Test against India.
The 38-year-old, who has played 165 Test matches, said: "It's been an honour and a privilege to have been part of the South Africa Test team since making my debut 18 years ago.
"I have enjoyed every moment out in the middle but I just feel that the time is right to hang up my Test whites."
Kallis, who has confirmed he will remain available for selection in limited-overs formats for South Africa, made his Test debut at the age of 20 and went on to score 13,174 runs, take 292 wickets and 199 catches.
He explained: "It wasn't an easy decision to come to, especially with Australia around the corner and the success this team is enjoying, but I feel I have made my contribution in this format. The last two years specifically have been a memorable journey with an exceptional group of cricketers.
"I am fortunate enough to have ended my Test career amongst a group of talented cricketers but more importantly, friends whom I will cherish for years to come.
"I don't see it as goodbye because I still have a lot of hunger to push South Africa to that World Cup in 2015 - if I am fit and performing."
Kallis, who had spells with Middlesex and Glamorgan in the 1990s, continued: "Winning an IPL title with the Kolkata Knight Riders was a special achievement, and I am still determined to taste that success with South Africa at an ICC event."
His final Test will be the Second Test, which starts on December 26 in Durban. The first Test in the two-match series ended in a thrilling draw.
Proteas coach Russell Domingo said: "The impact Jacques has made on South African cricket has been immense, not just as a player but as a human being. I'm not sure we will ever see another player of that stature very soon.
"Jacques' calmness, maturity and presence in the changing room will sorely be missed and hopefully he will still be able to play a role in this team's success in the near future.
" He has ambitions of playing in the 2015 World Cup and it will be important for us to manage him accordingly so that he is in prime form leading into the tournament."
Cricket South Africa president Chris Nenzani led the tributes as he said: "South Africans love their sporting heroes and Jacques is right up among the best; not only that but he has been there for the best part of two decades.
"We are truly entering a new era with three of the icons of the game - Ricky Ponting, Sachin Tendulkar and now our own Jacques Kallis - departing the Test arena within a short space of time.
"At a time when we live in a fast-changing world and not always for the better he has remained true to the best traditions of the game and of sportsmanship and has always risen above any kind of controversy.
"Happily, Jacques is not totally lost to the Proteas. Our ODI side is a comparatively young and inexperienced one and his contribution to our World Cup campaign will no doubt be as immense as it has been across all the formats up to now.
"Jacques, we thank you not just for what you have meant to South African cricket and indeed to the world of cricket but more particularly for the example you have set in being a modelSouth African for our youth and future leaders."