Italy began with most of its starters either on the bench or in the stands at the sparsely attended Super Stadium on the outskirts of Pretoria and was twice behind by halftime.
Shane Smeltz put New Zealand ahead after 13 minutes, meeting a free kick with a header and scoring his 14th goal in 25 international appearances.
Gilardino equalised in the 33rd minute, concluding a perfectly executed counterattack for the World Cup holders.
Simone Pepe took advantage of some open space and carried the ball up the right flank before sending a cross over to the left wing, where Fabio Quagliarella set up Gilardino's header with a delicate chip.
New Zealand took the lead again in the 42nd, with Chris Killen beating goalkeeper Marco Amelia to the ball and heading in off the crossbar from a Leo Bertos corner.
Gilardino made it 2-2 in the 48th with another header, following another setup from Quagliarella.
It was Gilardino's 12th goal in 32 appearances. He scored 19 goals for Fiorentina in the recently concluded Serie A season.
After the break, New Zealand went 3-2 up when Killen was tripped by Amelia inside the area in the 56th, earning a penalty which the Celtic forward converted.
Italy coach Marcello Lippi put on usual starters Iaquinta, Luca Toni and Mauro Camoranesi - plus Riccardo Montolivo - in the 60th minute, and Iaquinta promptly scored twice.
The Juventus forward slid the ball past charging goalkeeper Glen Moss in the 68th minute and then steered home a rebound from close range five minutes later for the winner.
Italy captain Fabio Cannavaro and goalkeeper Gianluigi Buffon were given the night off and watched from the stands.
Smeltz was named the best player in the Australian A League last season with the league's only New Zealand side, Wellington Phoenix. He recently signed with Gold Coast United.
Italy beat Northern Ireland 3-0 in another friendly on Saturday.
The Confederations Cup starts on Sunday with host nation South Africa playing Iraq.
Italy opens its campaign against the United States on Monday, faces Egypt three days later and concludes Group B play against Brazil on June 21.
New Zealand is in Group A with European champion Spain, South Africa and Iraq. "I'm really proud of the way the boys played ton ight and it gives us a degree of confidence ahead of our Confederations Cup opener against Spain," New Zealand coach Ricki Herbert said.
"Three nice goals tonight, hopefully that can continue.
"We could be the dark horses here, who knows. We are a young side and have a big tournament coming up with the World Cup qualifiers (later in the year.
"(Making) the second round here would be an absolute dream," Herbert added.
Lineups:
Italy: Marco Amelia, Davide Santon (Gianluca Zambrotta, 66), Alessandro Gamberini, Nicola Legrottaglie, Andrea Dossena, Gennaro Gattuso (Riccardo Montolivo, 60), Angelo Palombo, Simone Pepe (Mauro Camoranesi, 60), Giuseppe Rossi, Fabio Quagliarella (Vincenzo Iaquinta, 60), Alberto Gilardino (Luca Toni, 60).
New Zealand: Glen Moss, Dave Mulligan, Tony Lochhead, Ivan Vicelic, Andy Boyens, Leo Bertos, Simon Elliott, Tim Brown, Jeremy Brocke (Andy Barron, 75), Shane Smeltz, Chris Killen (Chris Wood, 81).