Ganguly's career seemed to be over after a row with coach Greg Chappell last year, when he was sacked as captain before being axed from both the Test and One-day squads.
The stylish 34-year-old batsman played his last Test against Pakistan in Karachi in February this year and his last One-dayer was against New Zealand at Harare in September 2005.
A brittle batting display by India in the ongoing five-match One-day series in South Africa, which they trail 3-0 after four matches, led the selectors to plump for the experienced left-hander.
"We decided to go with Ganguly's experience because our batting has failed in One-dayers. The youngsters have not been able to adjust to the bouncy wickets in South Africa," said chief selector Dilip Vengsarkar on Thursday.
Ganguly, who has scored 5,221 runs in 88 Tests, said he was hoping to put his experience to good use in South Africa.
"I am happy to be back but it is always a challenge playing in Tests, whether it is your first or 100th. As the tour will go on, players will get used to the bouncy pitches," he said.
"We have done well on bouncy tracks in Australia in the past and it is pretty much the same group of players and I am sure they will do well. It is just a matter of adjusting."
Venkatsai Laxman, recalled for the One-dayers in South Africa after a finger injury to skipper Rahul Dravid, replaced out-of-form opener Virender Sehwag as vice-captain for the Tests.
"Laxman has been named vice-captain because he has led various sides in domestic cricket in the past and also India-A teams," said Vengsarkar, who represented India in 116 Tests.
Paceman Zaheer Khan, who is playing in the ongoing One-day series, has also been named in the Test squad for the first time since the tour of Pakistan earlier this year.
He is one of the five pacemen in the squad including all-rounder Irfan Pathan, who has struggled in recent Tests and One-dayers.
"Pathan bowled well the other day in a One-dayer and also batted well. He is a player for the future, we are sure he will perform soon," said Vengsarkar.
Also making a comeback to the Test squad is left-handed opener Gautam Gambhir, who was ignored after a home series against Sri Lanka last year.
Middle-order batsmen Mohammad Kaif and Suresh Raina have been dropped from the Test side and will return after the One-dayers along with Ajit Agarkar.
Tendulkar, whose record of 35 Test centuries is under threat from West Indies captain Brian Lara, returns to Tests after missing the tour of the Caribbean earlier this year because of a shoulder injury.
Yuvraj has been ruled out because of a knee injury.
The first Test begins on December 15 in Johannesburg.
Test squad: Rahul Dravid (capt), Venkatsai Laxman (vice-capt), Virender Sehwag, Wasim Jaffer, Gautam Gambhir, Sachin Tendulkar, Sourav Ganguly, Mahendra Dhoni, Dinesh Kaarthick, Harbhajan Singh, Anil Kumble, Irfan Pathan, Munaf Patel, Vikram Rajvir Singh, Zaheer Khan and Shantakumaran Sreesanth.