Henrik Lundqvist turned aside 28 shots to end the Penguins' four-game winning streak.
New York matched a season high with its five goals and won for the fourth time in five games.
The contest was scoreless before McDonagh and Stepan produced goals in a span of 1:05 to get the Rangers started.
The only Pittsburgh goal came on the power play from Kris Letang that briefly cut the Penguins' deficit to 3-1 in the middle period.
All five goals came against Marc-Andre Fleury on 25 shots.
'How to Train Your Dragon 2' releases 5-minute clip
Lytro unveils camera that can focus a photo after shooting it