Italy booked their place in the semi-finals of the Confederations Cup Recife, Brazil, on Wednesday with a thrilling come-from-behind 4-3 win over Japan that also sent Brazil into the last four.
The Italians looked to be heading for a shock defeat after going 2-0 down to Japan midway through the first half, with Keisuke Honda slotting a 21st-minute penalty before Manchester United star Shinji Kagawa doubled the lead for the Asian champions.
However, Italy fought back with a three-goal blast either side of half-time, courtesy of strikes from Daniele De Rossi, an own-goal from Atsuto Uchida and a Mario Balotelli spot-kick to make it 3-2.
Japan levelled at 3-3 courtesy of a thumping header from Shinji Okazaki on 69 minutes as the momentum shifted again before Italy substitute Sebastian Giovinco sealed a dramatic encounter with the winner four minutes from time.
The result saw Japan eliminated along with Mexico, while Brazil and Italy will now face each other Saturday in Salvador in the final pool match to determine who qualifies as group winners - the runners-up will likely face world champions Spain.
It was an agonising exit for Japan, whose coach Alberto Zaccheroni had challenged his team to take the game to his Italian countrymen after a lacklustre display in their opening defeat to Brazil.
"I think we did show we have a lot of personality but we need to accumulate more experience," Zaccheroni conceded.
"I hope Italy now wins the Cup since we are not going to be in the semi-finals. I hope they win."
Italy coach Cesare Prandelli said he had had to reshuffle his pack after their poor start, withdrawing Alberto Aquilani and sending on striker Giovinco.
"It was a difficult game for us, we suffered. We knew Japan had one extra day to rest and it showed."
For 40 minutes Japan seemed destined to score a first ever success over the Azzurri.
Ryoichi Maeda had almost drawn first blood with a header on seven minutes but Gianluigi Buffon made a smart stop.
Kagawa then fired a left foot effort goalwards in the 19th minute that Buffon parried to safety.
But two minutes later, Japan took the lead from the spot as Buffon clattered into a 50-50 challenge with Okazaki and referee Diego Abal of Argentina ruled the Italian veteran had impeded his rival.
Honda, whose penalty-taking exploits earlier this month had ensured qualification for next year's World Cup in Brazil, drilled his kick low to Buffon's left and just inside the post.
Thereafter, Japan enjoyed a purple patch and after 33 minutes it was 2-0, Kagawa swivelling in the box to plant a left-foot shot low past Buffon.
Italian midfielder De Rossi earned a booking for tripping Honda as the Japanese, their confidence suddenly sky-high and playing neat one-touch football that brought shouts of 'ole' from the crowd, looked to go for the kill.
Against an Italian side that had before Wednesday lost only one of 23 competitive games under Prandelli, they failed to find the coup de grace.
And Andrea Pirlo gave Italy hope when he arrowed in a corner that was met by a powerful De Rossi header just before half-time for 2-1.
In what was turning into a superlative advert for attacking football Giaccherini then saw a low drive come back off the base of the post with almost the last kick of the first half.
The second half was no less action packed and soon after the restart Giaccherini beat Maya Yoshida and saw his low cross turned into his own net by a Uchida.
Three minutes after Uchida's faux pas Balotelli scored from the spot after Makoto Hasebe handballed in the box.
But Japanese heads did not drop and they made it 3-3 in the 69th minute when Yasuhito Endo crossed for Okazaki to head in.
In an astonishing finale Okazaki hit the post and, with Buffon stranded, Kagawa saw his header bounce onto the bar when it seemed he must score.
With four minutes left of a pulsating match Giovinco netted from close range from Claudio Marchisio's cross, meaning the pressure is off for the Italians as they go on to meet fellow Group A qualifiers Brazil in their final pool match on Saturday in Salvador.