Italy qualified for the quarterfinals of the European Championship after Antonio Cassano and Mario Balotelli scored in each half of a tense 2-0 victory over Ireland on Monday.
Cassano headed in with his back to the goal by the near post following a corner kick in the 35th minute on a warm and muggy night at the Municipal Stadium Poznan.
Balotelli came on as a substitute and doubled the lead in the 90th, a minute after Ireland was reduced to 10 men with Keith Andrews picking up his second yellow card.
Still, Italy had to wait a few moments after the final whistle to celebrate after receiving word that Spain beat Croatia 1-0 in the other Group C match.
"We suffered in the last few minutes because we were waiting for the result in the other game," Italy coach Cesare Prandelli said. "We have got through this group which wasn't easy with Croatia, Spain and even Ireland who, even though they were out, gave everything they could. ... Today we realized that beyond quality, you really need heart."
Italy will meet the Group D winner Sunday in Kiev — with France, England and co-host Ukraine among the possible opponents.
"No difference to us (who we play) we have already played Spain who are reigning world and European champions," Prandelli said. "If we play well we can take on anyone."
Spain won the group with seven points, Italy finished second with five, Croatia was next with four and Ireland — which was already eliminated — exited its first major tournament in 10 years with none.
"We played well tonight but without creating too many chances either," Ireland forward Robbie Keane said. "We're disappointed not to get anything out of the group, but we've been beaten by better teams."
The victory ended a five-match winless streak for Italy, which began the tournament with 1-1 draws against Spain and Croatia following three friendly losses.
Italy controlled the match for long stretches but Ireland — managed by former Azzurri coach Giovanni Trapattoni — threatened often with counterattacks.
Ireland goalkeeper Shay Given got his hand to Cassano's header but couldn't prevent it from going in.
Cassano fell ill with stroke-like symptoms on AC Milan's team plane in October and then required minor heart surgery. He was out for five months and has said repeatedly that he thought he might never recover.
Cassano also stood out for Italy at Euro 2004, but he has was left out of the Azzurri's last two World Cup squads by former coach Marcello Lippi.
"The victory was something we struggled for but the most important thing was to get through the group," Cassano said. "I couldn't wait for them to blow the whistle in the other game and for it to finish."
Italy had been worried about a 2-2 draw between Spain and Croatia, which would have eliminated the Azzurri no matter if they beat Ireland. That's exactly what happened at Euro 2004, when Italy beat Bulgaria in its final group match but was sent home when Denmark and Sweden finished 2-2.
Cassano wept on the pitch uncontrollably after that game eight years ago, despite being awarded man of the match. He received the award again after this game, this time with a smile.
"We Italians are used to suffering but we always give our best," Cassano said.
Balotelli's goal was a work of art. The 21-year-old striker acrobatically wrapped his shot around defender John O'Shea in midair, as he met a corner kick from Alessandro Diamanti.
Having started Italy's opening two matches, Balotelli replaced Antonio Di Natale in the 74th.
At the final whistle, as his teammates ran over to the bench to get the result of the Spain-Croatia match, Balotelli walked over to hug his former Manchester City teammate Given and trade shirts.
Andrews had been Ireland's most dangerous player.
Italy goalkeeper Gianluigi Buffon did well to control a bouncing effort from Andrews on the hour mark and the midfielder came even closer with a free kick that Buffon stopped with a diving save in the 79th.
"We had to suffer a lot in this game — perhaps more than in the first two," Italy midfielder Daniele De Rossi said. "We weren't afraid of them equalizing but they hit the long ball and all you need is one piece of good fortune."
With the temperature hovering at 86 degrees, half the stadium was filled with green-clad Irish fans — even with their team already assured of going home — while there was only a small pocket of Italian supporters.
Ireland wore black armbands to commemorate the 18th anniversary of shootings in Northern Ireland that killed six people.
Italy: Gianluigi Buffon, Ignazio Abate, Andrea Barzagli, Giorgio Chiellini (Leonardo Bonucci, 57), Federico Balzaretti, Andrea Pirlo, Claudio Marchisio, Thiago Motta, Daniele De Rossi, Antonio Di Natale (Mario Balotelli, 74), Antonio Cassano (Alessandro Diamanti, 62).
Ireland: Shay Given, Sean St. Ledger, Stephen Ward, John O'Shea, Richard Dunne, Glenn Whelan, Aiden McGeady (Shane Long, 65), Keith Andrews, Damien Duff, Kevin Doyle (Jon Walters, 76), Robbie Keane (Simon Cox, 86).