The tensions between the two sides were clear prior to kickoff, as the start of the match was briefly halted when Wrexham fans threw a flare onto the pitch.
Once the action got underway, it did not take the visitors long to break the deadlock, as Blaine Hudson fired the ball in from just a couple of yards out just over 50 seconds into the match.
Louis Moult came close to getting the hosts back on level terms a few minutes later, but his curling effort went just over the crossbar.
Wrexham quickly headed back down the other end, with Wes York unleashing a powerful strike from the edge of the box, but it came back off the crossbar.
Moult continued to pose a threat for the hosts at the start of the second half, lashing the ball just high of the bar moments after the restart.
The teams clashed when Rooney brought down York in midfield with a heavy challenge 50 minutes in, with the referee having to step in to separate the players.
Wrexham continued to come under pressure at the back though as Rooney and Moult led the charge for an equaliser, but it was Craig Hobson who eventually found the back of the net for Chester, drilling the ball in low from the middle of the box.
Chester pressed for a winner in the final minutes of the tie but Bachmann, who is on loan from Stoke City, made a string of saves to keep Wrexham on level terms, while Kieran Charnock saw his effort fly high.
Their late efforts were rewarded by Ben Heneghan found himself unmarked at the back post to slice in from a Kingsley James cross at a tight angle, giving him his first ever senior goal and winning the match for the hosts.
The result leaves Wrexham 10th in the table, while Chester climb up to 16th.