The one-run victory is only the second in the history of Test cricket.
Chasing 258 to win, England were 48/1 at the close of play on Day 4. On the final day, the visitors lost four wickets in quick succession but the duo of skipper Ben Stokes (33) and Joe Root (95) forged a 121-run stand for the sixth wicket, which appeared to be a match-winning partnership.
However, Wagner brought the hosts back into the contest as he struck twice to remove both Stokes and Root. The match was still going in England's favour as wicketkeeper Ben Foakes scored 35 runs.
With seven runs still needed and one wicket in hand, Jack Leach took a single before Anderson tickled one down the leg side to wicketkeeper Tom Blundell.
Earlier, Kiwi skipper Kane Williamson slammed a superb century to steer New Zealand to 483 all out in their second innings and set England a target of 258 runs to win the Wellington Test. Williamson hit 132 and Blundell was the last man out for 90 as the home team fought back after being asked to follow on.
The one-run victory is only the second in the history of Test cricket after West Indies' win over Australia in 1993. The match also became only the fourth in which a team won after being enforced follow-on.
Cricket experts took to Twitter and shared their views after the second Test between New Zealand and England went down to the wire.
Here are the reactions: