text: The 32-year-old had been in poor form but made a double century to inspire his side's fightback after England made 629-6 declared in Cape Town.
  "I believe I can be of greater value as a fully focused batsman and senior player at this time," said Amla.
  AB de Villiers will lead South Africa in the third Test in Johannesburg, which starts on 14 January.
  After his appointment as successor to Graeme Smith in June 2014, Amla captained the world number one side in 14 Tests.
  He won four and drew six but came under pressure during a 3-0 series defeat in India.
  Amla said he had considered quitting before the start of the series against England, who won the first Test by 241 runs in Durban last week.
  Until his marathon effort at Newlands, Amla, a veteran of 90 Tests and 7,108 runs, had not hit a Test century since December 2014.
  "I honestly feel a lot of the criticism that Hashim has faced in the last couple of weeks is very harsh," said South Africa coach Russell Domingo.
  "He is one of South Africa's greatest players. There hasn't been enough respect shown of his achievements as a player."
  De Villiers had raised doubts about his future in Test cricket during the first Test because of his busy workload, and handed over wicketkeeping duties to Quinton de Kock for the second match.
  The 31-year-old, who already leads the one-day side, said: "It is an incredible honour to captain South Africa in any format. The captaincy has obviously come at short notice and is the realisation of a lifelong dream.
  "At the moment my priority and focus is placed on leading this team to what can be a memorable series win against England. This Test squad is motivated and determined to turn our performances around and I'm looking forward to taking up that challenge as captain."
  England captain Alastair Cook was sad to learn of Amla's resignation.
  "You're under pressure as a captain for a lot of the time," said Cook.
  "It's always sad when someone steps down because to captain your country is a huge honour and a real privilege.
  "He'll have his reasons and I wish him all the best - he's a really nice guy."
  Cricket South Africa chief executive Haroon Lorgat said Amla "still had a huge role to play in shaping the success of our team".
  He added: "He is just that type of a person and we are very fortunate to have him in our stable.
  "I want to thank AB for readily accepting the challenge of rebuilding our Test team as we seek to remain the best team in the world."
target: Hashim Amla resigned as South Africa captain immediately after his side drew the second Test against England.