Regan Ware got New Zealand on the board just before half time, although it took a pick-up from his bootlaces to secure the ball.
Samoa took it out to 22-5, 15 seconds into the second half but Ware went in again, to be followed by Tim Mikkelson and Akuila Rokolisoa.
However, Samoa had the ball in their possession heading into the final minute and it was only when they failed to control the ball at a breakdown, with nobody in place at halfback to move the ball, that New Zealand was able to secure the ball and kick it to touch to give them the win.
WHAT A COMEBACK! The #AllBlacks7s finish top of Pool D to secure their spot in the Cup quarterfinals
The All Blacks Sevens had an untroubled start to the day. Their first game, the opening game of the tournament, resulted in a 43-0 win over Japan. Regan Ware and Andrew Knewstubb scored two tries each while Jona Nareki, Kurt Baker and Joe Ravouvou also crossed.
Against Spain, who beat them 26-24 in the Vancouver tournament last month, they took a 53-0 win with Akuila Rokolisoa scoring twice while Sam Dickson, Scott Curry, Nareki, Baker, Ware, Joe Webber and Ravouvou all scored while Tim Mikkelson joined the point scorers when landing a conversion.
In other games, Australia beat France 24-12 and Argentina 22-17 while England were beaten 12-0 by Wales. Scotland beat Fiji 19-12.
First try of the #Singapore7s and it's a fast one. Regan Ware of @AllBlacks7s hits 35 kmph on his way to the try line pic.twitter.com/s7vdp7vc1O— World Rugby Sevens (@WorldRugby7s) April 13, 2019