Wales showed the value of eight days preparation hammering Namibia 81-7 to keep their hopes for a quarter-finals berth alive.
The bonus-point win sees Wales, who scored 45 points in the final quarter, overtake Samoa to go second in Pool D and set up what promises to be an entertaining finish to the pool on Sunday.
A tired-looking Namibia, showing signs of exhaustion following four matches in 14 days, missed 41 tackles and are the first team to be eliminated from the tournament after failing to collect a point.
Wales started the match at a high pace, knowing they needed at least a bonus-point win to be in with a chance of qualifying for the next round.
They scored three tries in 20 minutes to hammer home the African side's misery.
But Namibia, who had just four days to prepare for the match, responded well, keeping their more fancied opponents scoreless in the second 20 minutes of the first half while having a couple of opportunities for points of their own.
Fly-half Theuns Kotze's two missed attempts, including one bouncing off the left post, meant the Africans were left looking for their first points in the second half.
Despite a period of dogged defence from the Namibians, Williams scored his second try - and more importantly Wales' fourth - to stretch the lead to 36.
The pressure was immediately off the Welshmen, and their players began to show more enterprise.
None more so than prop Gethin Jenkins, who slipped past two tackles before bursting over the line to score in a 35-metre effort.
But Namibia proved they still had the legs when Nico Esterhuyse intercepted a flat pass from Stephen Jones.
Knowing he was going to be run down, he found fellow lock Heinz Koll, who outsprinted hooker Lloyd Burns to score in the corner for a try that will go down in Namibian rugby folklore.
A tired Namibia was reduced to 14 men for 10 minutes after substitute prop Raoul Larson was sinbinned for another scrum offence that saw two quick tries to blow the score out to 57-7.
Larson made little impact when he returned, however, as Williams completed his hat-trick to extend the Welshmen's lead to 57.
Wales pushed all the way to the end, with three further tries in five minutes hammering home the difference between the countries.