Townsend cancelled out Chris McCready's opener with a superb free-kick but saw red early in the second half for an elbow.
Former Chesterfield goalkeeper Barry Roche brilliantly turned over a Liam Cooper header in the eighth minute before Drew Talbot headed against the crossbar from the resulting corner.
Roche then dived to his right to turn away a Danny Whitaker drive in the 17th minute, with Morecambe going ahead against the run of play when McCready's header was ruled to have crossed the line despite a superb reaction save from Tommy Lee.
Chesterfield deservedly equalised in the 40th minute when Townsend sent a 20-yard set-piece over the wall and inside Roche's left-hand post.
But his afternoon turned sour around the hour mark when he was sent off for what referee Carl Berry saw as an elbow on Will Haining.
The home side continued to dominate and Whitaker shot just wide in the 87th minute although it needed a fingertip save from Lee to deny Lewis Alessandra two minutes later.
- Sports & Recreation
- Barry Roche
- Danny Whitaker
- Chris McCready