The striker scored with his side's first real attempt on goal in the 25th minute when he turned in a Craig Noone cross from close range following a mix-up between Tranmere goalkeeper Joe Collister and defender Marlon Broomes.
Barnes's side struggled to create anything of note before the interval, and they found themselves 2-0 down just after the restart.
Stuart Fleetwood sent Noone scampering clear and although Collister saved his initial shot, Stansfield was on hand to tap in his second of the afternoon.
Tranmere reduced the arrears in the 63rd minute when a long throw was flicked on at the near post and Michael Ricketts headed past the dive of Exeter goalkeeper Oscar Jansson.
City had chances to increase their lead, while Tranmere could have equalised in stoppage time but Broomes' header went well wide of goal to ensure City earned their first home win of the season.