Manchester returned to goal for two minutes before Spain levelled once more and the Kiwis opted to put the kicking back in play again to try and force a win.
But Spain sunk the Black Sticks' hopes in the final 30 seconds of the match when Pau Quemada capitalised on a defensive error and shot into an open goal.
The result sees the Kiwis finish third in Pool A with a cross-over quarter final looming on Wednesday against the second placed finishers in Pool B, which is likely to be either Germany or Belgium.
Head coach Darren Smith said his side put it all on the line for three points but unfortunately couldn't quite get there.
"We were a bit slow early on but I thought we played well in the second half and showed some real intent and determination," he said.
"We took a calculated risk with the goalkeeper off the field but it allowed us to hold the ball well in the defensive midfield and then create some good attacking pressure and score three goals.
"It's a disappointing final result for us but we are certainly up for our next challenge and we know we will have to be on our game no matter who we come up against."
Forward Marcus Child celebrated a milestone with his 100th international cap in the match.
BLACK STICKS 3: (Shea McAleese, Nic Woods, Kane Russell)
SPAIN 4: (Josep Romeu, Enrique Gonzalez, Alvaro Iglesias, Pau Quemada)
Halftime: Spain 1-0