"It's been an honour and a privilege to play for Wales. It's meant a hell of a lot to me, but everything has to come to an end and that is me done now," he told the Western Mail.
Williams made his Wales debut against the Barbarians in 1996, and his work rate and ball-handling skills soon made him a stalwart of the side. He captained the side on five occasions, but he turned down the chance to lead Wales at the 2003 Rugby World Cup because he felt he lacked the necessary experience.
But after the defeat to Fiji on Saturday, Williams felt it was time to hang up his boots.
"It's not the way I would have wanted it to end," said Williams, who will look back to the 2005 Grand Slam success as the high point of his international career. A string of superb performances earned him the player of the tournament award and selection on the Lions tour to New Zealand.
WRU Group Chief Executive Roger Lewis paid tribute to Williams's career, saying: "I'm sure everyone would want to thank Martyn for being a total servant of the game. No-one could ask more of a player such as Martyn Williams."
Williams has indicated he will play on with his region, Cardiff Blues, for a further two seasons become undertaking the training required to become a commercial banker.