You are not permitted to download, save or email this image. Visit image gallery to purchase the image.
Half-centuries from Tamim Iqbal and Mohammad Mithun had powered Bangladesh to 271-6 after being put into bat at Christchurch's Hagley Oval.
New Zealand wobbled early in their chase but Latham's 110 not out, his fifth ODI century, helped the hosts reach the target with 10 balls to spare.
There was a moment of controversy when Kyle Jamieson took a return catch from Tamim on 34, with the batsman given out.
TV umpire Chris Gaffaney overruled the 'soft-signal' on the grounds that while the catch was taken cleanly, Jamieson was not in complete control of the ball as he fell to the ground and ball grazed the pitch.
Bundled out for 131 in the Dunedin opener, which New Zealand won by eight wickets, the tourists needed an improved batting display to stay alive in the three-match series.
Skipper Tamim led by example, scoring 78 before being run out. Mushfiqur Rahim had defended a ball from Jimmy Neesham before the batsmen decided to steal a single.
Neesham had no time to stoop and pick the ball up, so he kicked it onto the stumps with Tamim short of his ground.
Mithun, who smashed 73 not out off 57 balls, provided the late surge with his clever shotmaking.
New Zealand began briskly but slumped to 53-3 in the 11th over.
Latham raised 113 runs with Devon Conway (72) to calm the nerves in the New Zealand dressing room.
Tamim sent back Conway with a direct hit but Latham stayed put till the end to fashion their second successive victory.
The third and final ODI will be played in Wellington on Friday.