They controlled the game from the off, opening the scoring when Kyle Bennett fired home from 20 yards.
Michael Doyle hit the bar from range for the visitors, who doubled their lead when a Ben Davies cross was turned into his own goal by Matt Pearson.
Pompey's Doyle did score, volleying beyond Jason Mooney from 30 yards, before Shay McCartan pulled one back.
The result means Stanley are down to sixth, while Paul Cook's side are now six points off the final automatic promotion place.
Portsmouth scored three first-half goals away at Accrington to move above them into fourth in League Two.