The British side looked unstoppable early on, racing into a 21-0 lead by half-time.
But in the second half, with the wind in their faces, Britain toiled - and New Zealand ran in tries almost at will at one point.
They ran out of time to press their dominance home, however, with Britain gaining the ball from the final restart and safely getting it into touch after the clock went into the red.
Fiji fans celebrate rugby sevens gold and first Olympic medal
Having won both previous group games, 31-7 against Kenya and 21-19 against Japan, Britain's men topped their group.
And New Zealand went through regardless thanks to Fiji beating USA in their final match of the pool stage.
The Fijians' reward? A match against New Zealand in the first knockout stage.
New Zealand have looked were without Sonny Bill Williams who is out of the tournament - and out of the game for nine months - after partially rupturing his Achilles tendon.
The eight qualifiers for the last eight are Fiji, New Zealand, Japan, France, Britain, Argentina, South Africa and Australia.
Watch Fiji go wild as men's rugby 7s deliver first gold and PM declares public holiday
Fiji thrash Great Britain to take gold - their first Olympic medal