Two goals in the final 10 minutes have helped the Black Sticks men advance to the last 12 at the Hockey World Cup in India.
New Zealand fought back from two goals down to draw 2-2 with Spain in their final pool match at Kalinga Stadium in Bhubaneswar on Friday (NZ time) to finish third in their pool.
World number eight Spain scored two field goals in the opening two quarters through Albert Beltran and Alvaro Iglesias to go into halftime 2-0 ahead.
But the Black Sticks made a stunning comeback in the final period and scored through Hayden Phillips and Kane Russell in the 50th and 56th minutes respectively to share the spoils.
The result put New Zealand second in Pool A, but France stunned Olympic champions Argentina 5-3 in the biggest upset of the tournament to leapfrog the Black Sticks into second, meaning Spain misses out on a spot in the next round.
France finished second behind Argentina (six points) on four points with a better goal difference than New Zealand (four points). The France secured the second spot with a goal difference of plus-one, against the Black Sticks' minus-two.
The NZ men beat France 2-1 in their opening pool match, followed by a 3-0 defeat to Argentina.
Finishing third, the Black Sticks will face China, Ireland or England in the crossover knockout round, with the winners likely to face Argentina or Australia.