Antonio Cassano's first-half header and a spectacular Mario Balotelli volley in the final minute sent Italy through to the Euro 2012 quarter-finals as Group C runners-up after a 2-0 victory over Ireland on Monday.
Cassano glanced in Andrea Pirlo's corner on 35 minutes, the ball clearly crossing the line before Damien Duff hacked clear.
Cassano's strike partner Antonio di Natale was replaced by Balotelli and the Manchester City striker made a stunning impact on the game.
Substitute Balotelli swivelled to thump in a corner from eight metres out to secure victory.
Italy, who will play the Group D winners in the last eight in Kiev on Sunday, finished runners-up on five points, behind group winners Spain on seven.
Ireland, already eliminated after defeats by Croatia and Spain, threatened sporadically with their best moment coming when keeper Gianluigi Buffon parried a fierce drive from Keith Andrews who was sent off on 89 minutes.
Cassano, who missed half the season with AC Milan after undergoing a minor heart operation, headed home 10 minutes before the break and Balotelli brilliantly hooked the ball home in the final minute to leave Italy second with five points behind Spain.
Italy, who played with one eye on the Croatia v Spain game, deserved their win although they had to survive an aggressive late rally from Ireland, coached by their wily 73-year-old Italian Giovanni Trapattoni, before substitute Balotelli's strike.
"It has been a very difficult match, we came up against a team that made us suffer," Italy coach Cesare Prandelli said.
"Today we knew that heart mattered more than quality. Tonight we created a lot, I hope it will be like this also in the next match."
The physical Irish, already eliminated after two defeats, forced a flurry of late free kicks and corners as Italy, who gave up leads in 1-1 draws with Spain and Croatia, again appeared to tire.
Having conceded early goals in losses Croatia and Spain, Ireland were determined not to get caught out again and went straight on to the attack.
Backed by a vociferous and large contingent in the crowd, they looked briefly threatening against an Italian side which featured four changes to the starting line-up.
Italy took their time to get going with Andrea Pirlo getting plenty of the ball but struggling to find openings for Cassano and strike partner Antonio Di Natale who replaced Balotelli.
Di Natale had the first real chance after a break down the left by Federico Balzaretti and there were appeals for handball as his shot was blocked by a defender.
Cassano then had a shot fumbled by Shay Given before Italy went ahead from a corner.
Pirlo's inswinging effort found Cassano at the near post and, although Given got a hand to his header, the ball crossed the line before Damien Duff, making his 100th appearance, could hook it away.
Italy kept attacking after the break, Cassano wasting a good chance with a side-footed shot before Daniele De Rossi curled another effort over.
A neat combination between Thiago Motto and Cassano then set up Di Natale whose shot from a difficult angle was blocked by Given.
Keith Andrews reminded Italy that the game was not over as his awkward long-range shot gave Gianluigi Buffon his first real test of the game on the hour.
Italy began looking nervous and there was a rare moment when Pirlo lost possession to Andrews in midfield but De Rossi came to the rescue with a timely tackle to block the Irish midfielder's shot.
Another thumping Andrews shot was saved by Buffon as Italy clung on and the Ireland midfielder was sent off for his second bookable offence moments before Balotelli settled matters with a superb piece of skill, the maverick forward living up to his reputation when he failed to celebrate a stunning goal.
"The fans have been fantastic but it's a shame the team didn't perform as well as we know we can and got a result for them," said Ireland striker Robbie Keane.
"We're disappointed that we didn't get something out of the group. We've been beaten by better teams."
Photo: Ireland's goalkeeper Shay Given (L) reacts as Italy's Leonardo Bonucci (R) and scorer Mario Balotelli celebrate a goal during their Group C match at the City stadium in Poznan (REUTERS/Bartosz Jankowski)