The RBS 6 Nations rivals will now clash in Wellington next Saturday, with the winner set to meet England or France for a place in the World Cup Final.
Ireland went into their final group game on the back of wins over the Unites States, Australia and Russia but Declan Kidney's men knew that defeat to the Italians would mean an early exit for the second World Cup in a row.
Paul O'Connell and co led just 9-6 at half-time but tries from Brian O'Driscoll and Keith Earls in the first 15 minutes after the interval effectively put the result beyond doubt.
Lions veteran Ronan O'Gara added 16 points with the boot, while replacement fly-half Jonathan Sexton kicked a penalty and converted a second score from Earls with the last play of the game.
"We're delighted with the win," said Ireland skipper O'Driscoll.
"We knew we needed it and I'm glad we were able to deliver in that second half, ably helped by the best crowd we've played in front of so far. We owe them a huge debt of gratitude.
"We knew we were going to have to be patient. Against any team, you have to grind them down and go through the phases. We were good and patient and took our scores clinically.
"Playing Wales is going to be another great challenge. It's been very close in recent years and it'll be the team that turns up on the day that goes into the semi-finals."
Earlier on in the day, Wales scored nine tries as they finished their group matches in some style.
Lions centre Jamie Roberts scored twice, with Scott Williams, George North, Sam Warburton, Lloyd Burns, Leigh Halfpenny, Lloyd Williams and Jonathan Davies also crossing as Wales built on previous wins over Samoa and Namibia.
Wales' last World Cup campaign came to a premature end with a shock defeat to the Fijians four years ago but a repeat was never in question as Wales had a four-try bonus point sewn up by half time.
"This was about qualifying out of a tough group," said Wales coach Warren Gatland.
"I am particularly delighted at the attitude of the players and now we can look forward to playing the quarter-final next week.
"So far in this competition we have been trying to come in under the radar and if that continues we will be pleased.
"There's nothing like winning to build a bit of character and it also meant a lot that we didn't concede a try."