First-half goals from Agyemang and David Connolly put the visitors in the driving seat.
Mathias Pogba pulled one back for Crewe, but Portsmouth held on to complete the double over the home side and a claim a long-awaited three points.
Agyemang span Mark Ellis and drilled the ball into the bottom corner to fire the visitors ahead with six minutes gone.
Gabor Gyepes then shot over from long range before Connolly shot straight at Crewe goalkeeper Steve Phillips from 25 yards.
The visitors doubled their lead in the 29th minute when Agyemang clipped the ball to Connolly at the far post and the latter side-footed home Pompey's second goal.
Pogba should have given Crewe a lifeline minutes later, but the winger totally missed the ball with just goalkeeper Simon Eastwood to beat from 12 yards out and at the other end Connolly then hit the side-netting before Jonny Ertl's cutback was spooned over by Jed Wallace as the visitors continued to carve out chances.
Crewe pulled one back in the 63rd minute when Byron Moore's initial shot was saved and the winger fired the rebound back across goal for Pogba to poke in at the far post.
Ajay Leitch-Smith's shot was easily saved before Moore failed to keep Pogba's low cross on target as Crewe looked to level.
Substitute Adam Reed almost settled the visitors' nerves with 10 minutes to go, but his curling shot came back off the foot of the post.