Wrexham had a few early scares before a goal calmed their nerves and put them on the way to victory.
Oldham boss Iain Dowie blamed poor defending but said he was short of players. He added: "We can't keep playing pretty patterns without a reward.
"It's difficult to defend some of our defending. We were totally in control of the game early on and Wrexham didn't know how to handle us.
"A throughball caught us out and then we missed a simple cross that cost another goal. It was just madness, suicidal defending. I don't like my team capitulating in that fashion." Denis Smith was happy to see his Wrexham side come through a sticky patch to finish with a goal spree. He admitted: "Early in the first half Oldham were as good as anyone we have seen.
"We were having to dig deep to keep in touch with them. It was a gamble keeping on playing the way we were in an attacking formation, but we defended well under pressure and came through." Lee Jones set Wrexham on the way with his eighth goal in nine games. A long ball from Dennis Lawrence put the striker through to shoot across Les Pogliacomi in fine style.
The Oldham keeper was caught out by a cross by Darren Ferguson, allowing Carlos Edwards to head the second goal. Hector Sam nearly added a third goal before half time when his shot hit the post.
Lawrence put the home side further in front early in the second half with a header that the goalkeeper grabbed, but couldn't keep from crossing the line as he fell backwards under pressure.
Oldham's defenders were having serious trouble and Danny Hall conceded a penalty for a hasty tackle that sent Chris Llewellyn sprawling near the hour.
Jones stepped up to take the penalty but his tame shot went straight to the keeper for an easy save.
Oldham must have rued the missed chances earlier when Chris Killen shot wide, Darren Sheridan headed past the post and Calvin Zola twice missed the target.
With the game safe, Wrexham brought on their 17-year-old striker Mark Jones and within three minutes he turned his marker and hit a superb fourth goal from 20 yards out.