Needing to win by eight points to avoid exiting the tournament in the pool stages for the first time in their history, Scotland dominated the opening 40 minutes and put themselves on course for the knock-out stages when they eked out a 12-3 lead early in the second-half.
Jonny Wilkinson continued his rotten form with the boot - he has now missed 11 of his 19 shots at goal - but found form when it mattered to kick a penalty and a drop goal before Chris Ashton burst over at the death.
After topping Pool B by winning all four of their games, England will now face France, who were stunned by Tonga earlier in the day, next Saturday in Auckland.
And despite looking second best for much of their defeat of Scotland, Moody insisted England deserved to progress at the expense of Scotland - who must now hope Georgia shock Argentina to qualify.
"It was incredibly difficult and full credit to Scotland, they played a fantastic match," he said.
"We didn't make it easy on ourselves with the penalty count, but Scotland made it incredibly difficult for us and we came out on the right side in the end.
"We knew Scotland would come out with all their fire, but in the second-half we countered it and it was a fantastic performance by our boys. We came out on top in a few of the scrums in the second-half."
Euan Murray, who missed Scotland's Sunday defeat to Argentina due to his religious beliefs, dominated in the scrum against Matt Stevens and allowed Chris Paterson and Dan Parks to kick Scotland into a 9-3 lead at the break.
Wilkinson had endured a rotten first-half and missed a drop goal from 15 yards before Ben Foden denied Simon Danielli before finally Scotland opened up a nine-point gap only for Wilkinson to quickly cut it back.
And while Scotland hunted for the try that would put them through, Wilkinson cut the lead further before Ashton was spotted alone on the wing and ended the contest in England's favour.
Scotland head coach Andy Robinson said: "I can't fault my sides effort but at the end of the day games like this are won and lost by inches and that's what happened last week and that's what happened this week.
"We gave ourselves a chance but England responded strongly. We are disappointed but we have enjoyed the World Cup immensely and I am proud to work with this team, they are an outstanding group of people."