Martyn, who fought his way back into the Test team after a disappointing run against England in the 2005 Ashes series, notified officials on Friday morning of his decision to retire, Cricket Australia said in a statement.
The 35-year-old, who scored only 16 runs in the second Ashes Test, said he was leaving the sport "with a deep awareness of the opportunities that the game and Cricket Australia have provided for me."
"However, I'm also aware of the tremendous challenges facing Australian cricket including this current Ashes series," he said.
"Such challenges require people who are more than 100 percent committed, dedicated, disciplined and passionate about the game.
"I feel, therefore, it's time for me to move aside."
Martyn said the decision to quit was made in the last 48 hours.
He said while he realised he could lose friends for retiring, "I also said to myself that if I stayed doing what I was doing I may equally lose respect for myself and the friendship of those around me who are entitled to expect from me more than 100 percent."
Australia captain Ricky Ponting said the team would miss Martyn.
"Damien is one of the world's most unsung players in both forms of the game and I don't think it is really understood how good a player he actually is," he said.
Martyn played 67 Tests, beginning in 1992, scoring 4406 runs at 46.37. His last Test was Australia's fifth-day win against England in Adelaide on Tuesday, a match cited by Ponting and spin bowler Shane Warne as Australia's best ever victory.
Martyn, who also played 208 one-day international matches, said he had enjoyed everything the game had given him.
"I have gained from it more then I could have ever imagined. I have made, in the playing of cricket, lifelong friends," he said.
Cricket Australia is set to announce the team for the third Ashes Test in Perth later Friday. Australia leads the series 2-0.