Antonio Cassano's first-half header and Mario Balotelli's spectacular late volley gave Italy a 2-0 win over Ireland which took them into the Euro 2012 quarter-finals as Group C runners-up.
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."
(Editing by Ed Osmond)