England held on to win a thrilling third one-day international by four runs, despite a classy century from New Zealand captain Kane Williamson.

On a difficult surface, England battled to 235, a total that looked plenty when the hosts slipped from 80-1 to 103-6.

Williamson added 96 with Mitchell Santner and reached 100 in the 49th over, leaving 15 to get from the 50th.

He hit Chris Woakes' third ball for six but could not find the required maximum from the final delivery in Wellington.

England go 2-1 up and can seal the series in Dunedin on Wednesday.

Victory in a match that begins at 22:00 GMT on Tuesday would give England their fifth successive ODI series success as they build towards the 2019 World Cup on home soil.

That World Cup ambition seemed particularly pertinent in Wellington, a ground where England suffered their must crushing defeat in their abject 2015 tournament - a nine-wicket loss to New Zealand in a day-nighter completed before the floodlights were turned on.

Here, Eoin Morgan's improving side adapted to the tricky conditions. Their batsmen showed the required patience and application, spinners Adil Rashid and Moeen Ali dismantled the New Zealand middle order and the death bowling did not crack under the pressure of a tight finish.

Whereas victory in the second ODI in Tauranga was an all-round demolition of the Black Caps, this was a streetwise and intelligent performance, even if England were almost denied by the brilliant Williamson.

Wonderful Williamson denied at the last

In contrast to England's innings, there seemed to be no evidence of the ball misbehaving when Colin Munro was leading the New Zealand chase. Skittish at first, the left-hander grew in confidence to punish the inaccuracy of Tom Curran and the fit-again Mark Wood.

However, after he was brilliantly caught for 49 at short cover by Ben Stokes off Rashid, the Black Caps came close to a complete implosion.

Mark Chapman miscued to point, Tom Latham was lbw on review and Colin de Grandhomme holed out to long-on, all from Moeen's off-spin. In between, leg-spinner Rashid trapped Henry Nicholls leg before. At one stage, the home side lost three wickets for one run in eight balls.

However, the unflappable Williamson, returning after missing the second ODI, remained. The skipper played cuts and swatted a Moeen full toss for six but, in the main, accumulated with dabs behind point and nudges off the pads.

He found an ally in left-hander Santner, who made 41 before being run out backing up off the fingertips of Woakes, departing with 36 required from 28 deliveries.

Although Williamson hit Curran's first ball of the penultimate over for four to bring up his century, the Surrey seamer conceded only three more singles.

Fifteen from the final over became seven from three balls when Williamson slapped Woakes over the leg-side fence, only for the Warwickshire man's full length to yield just two more runs and leave the home skipper close to tears as he left the field.

Mature England adapt

England lost four of their 19 completed ODIs in 2017 and, for two of those defeats, were guilty of naively disrespecting the conditions.

In the third match against South Africa at Lord's in May, they were reduced to 20-6 on a green surface and, in the Champions Trophy semi-final on a slow Cardiff pitch, Pakistan bowled them out for 211. On both occasions, they were unable to curtail their ultra-aggressive intent.

Here, as they ball leapt, kept low or stuck in the surface, England recognised that run-scoring was difficult and favoured accumulation over all-out assault.

Morgan's 48 came from 71 balls, while Stokes was even more reserved for 39 from 73, their fourth-wicket stand of 71 compiled mainly when medium-pacer De Grandhomme was bowling 10 overs in succession for 1-24.

Even though Morgan was bowled by Tim Southee and Stokes was caught at long-off to give impressive leg-spinner Ish Sodhi the second of this three wickets, they had laid a platform for the tourists to accelerate.

Jos Buttler added 29 from 23 balls, Moeen 23 from 19 and Woakes 16 from 15. Even Rashid's 11 from eight deliveries was most welcome.

England took 68 runs from their final 10 overs. Ordinarily, that would be a disappointing return. Here, it was just enough.

'A brilliant game of cricket' - what they said

England captain Eoin Morgan to Test Match Special: "It took us a while to get going and it felt like we were batting with the wrong end of the bat. It was challenging, but we committed to the plan.

"The fact we have defended 230 is a big feather in our cap. We aren't known for that. We are known as a side who are aggressive with the bat, but this winter our bowlers have done well.

"You get to see the true character of guys when the pressure is on. It's great to see players stepping up to the plate and delivering their skills."

New Zealand captain Kane Williamson: "You have to give credit to England because they got in on that surface and they deserved to win. In our innings we were in a position of strength but stumbled a bit and it's shame not to get across the line.

"Our bowling unit did a good job and it was a competitive total. We started well but couldn't hold it together in the middle."

Former England batsman James Taylor on BBC Test Match Special: "Well played England. They were put in on a testing surface. New Zealand got off to a decent start, but those five wickets for 23 runs in the middle overs did it for them.

"I feel for Kane Williamson, what a knock - he played smart, intelligent cricket and batted beautifully."

Ex-England spinner Graeme Swann on TMS: "The discrepancy in bounce made this a below-standard one-day pitch. Ben Stokes milked it well; Martin Guptill just tried to play his shots and got out.

"Kane Williamson deserved to be in a successful chase but his middle order let him down."