Updated

Italy finished off its win against Ireland, and turned its attention to the final seconds of Spain against Croatia.

When the final whistle blew in Gdansk, Italian goalkeeper Gianluigi Buffon put his arms in the air to celebrate Monday at Municipal Stadium in Poznan.

Antonio Cassano and Mario Balotelli scored as Italy defeated Ireland, 2-0, and it advanced to the quarterfinals of Euro 2012 when Spain beat Croatia, 1-0, in the other Group C match.

Even with the win, Italy would have been eliminated if Croatia would have tied its match against Spain. Instead, Spain held on to claim the group and Croatia was the odd team out as it was eliminated on the final day of the stage. Italy finished second.

Italy will play Sunday in quarterfinals against the Group D runner-up, either England, France or Ukraine. Spain will play the Group D winner Saturday.

The Italians were expected to beat the Irish, who lost their first two matches against Croatia and Spain by combined scores of 7-1, and they needed a victory to have any chance to extend their tournament.

Although Italy was not impressive at times, it controlled most of the match as it put Ireland under pressure in both halves.

Antonio Di Natale had a chance blocked by Ireland defender Sean St Ledger just after the half-hour mark, Cassano unleashed a long shot that fooled Shay Given but skipped off the Irish goalkeeper and wide, and the first goal followed.

Off a corner kick from Andrea Pirlo, Cassano flicked a header on from the near side that went off the fingertips of Given and just over the line before Irish defender Damien Duff was able to clear in the 35th minute.

Di Natale was denied by another block from St Ledger early in the second half, and with Italy sitting on one-goal lead, Ireland had its best chance to steal a goal and tie the match.

Keith Andrews drilled a free kick low through to Buffon, who could only knock the ball down and watch as it was cleared from the area by a teammate.

Balotelli capped the first win for Italy at the tournament in the 90th, as he fended off Ireland defender John O'Shea and, with his back to the goal, turned an over-head kick past the defender and Given on a brilliant finish.

Italy snapped a six-fixture drought at a major tournaments as it won its first game since a 2-0 win over France in the final game of group play in Euro 2008. Ireland joined the Netherlands as teams to lose all three matches this year.