Ritchie Partridge's excellent second-half double blast fired Chester to the Cheshire derby honours at Edgeley Park.
On a glorious afternoon it was Stockport who created the first chance. Jason Taylor's long throw-in was flicked on but Anthony Pilkington headed his effort straight at keeper John Danby.
Stockport old boy Tony Dinning blasted a shot over as Chester responded, but there then followed a 20-minute spell which saw hardly any action in either penalty box.
It was the visitors who broke the monotony on 26 minutes when Partridge burst through the middle, but his shot was blocked by Ashley Williams.
Soon after, midfielder Mark Hughes rose well but headed over the Stockport crossbar.
Partridge again made a powerful run into the Stockport danger zone but this time Conrad Logan well saved his powerful shot.
At the other end Matty McNeil and Adam Griffin both saw shots blocked in quick succession as the hosts tried to force the pace.
A bizarre goal handed Stockport the lead deep into first-half stoppage time. A harmless-looking low cross from the left by Taylor was spilled at the near post by keeper Danby, and the referee and his assistant agreed that the ball had just crept over the line.
Chester levelled matters with the first chance of the second period on 53 minutes. Partridge ran at the County defence before unleashing a powerful drive which thundered past Logan.Kevin Ellison, another Stockport old boy, headed over just past the hour mark, then the same player volleyed onto the Stockport crossbar from close range following Partridge's measured cross.
Chester's target-man John Murphy headed inches wide as the clock ticked down, but Partridge was to have the last word to take all the points.