A last-second try to Josua Vakurunabili gave Fiji a thrilling 19-17 win over New Zealand in their final pool match of the Sydney Sevens on Saturday.
New Zealand looked to have sealed the game when they led 17-14 with only seconds remaining.
But the New Zealanders knocked on while deep in attack and from the ensuing scrum only five metres out from their own line, the Fijians broke clear.
New Zealand scrambled desperately in defence but were unable to stop the massive Vakurunabili crashing over and giving Fiji first place in the pool.
The Olympic gold medallists will take on the USA in the Cup quarter-finals while New Zealand play arch-rivals Australia.
Australia topped their pool with three wins, although they were made to work hard by Scotland to keep a clean sheet on Saturday.
After the Australians skipped away to an early lead, Scotland fought back and took the lead.
But Tom Lucas crossed for the home side with a minute left on the clock and the Australians held on to win 24-21.
The other quarter-finals feature Pool B winners Argentina against Pool C runners-up England and South Africa, who topped Pool C, against Kenya.
Argentina had victories over Kenya, Wales and France and will go into their quarter-final as slight favourites over an English side that was thumped by South Africa 33-12.
South Africa have been hugely impressive in their three pool wins, racking up 121 points and conceding just the 12 in the England game.