England set a 31-run lead into the second innings against New Zealand as Jack Leach is the last wicket to fall.