But Italy pulled back with two tries of its own from Edoardo Padovani and Luca Morisi and two penalties from Tommaso Allan to go in at the break with a surprise 16-12 lead. However, Keith Earls' try shortly after the restart settled Ireland's nerves and Conor Murray, who had added the extras, scored and converted another try to give Ireland the bonus point.
Defending champion Ireland moved into third place in the table, one point behind England and three behind Wales. Ireland hosts France on March 10 before its final match against Wales in Cardiff. "There's certainly stuff we can do better, stuff we can work hard on over the next couple of weeks before France," Ireland captain Peter O'Mahony said. "There's a lot of expectation on us, but it's a difficult thing to win away from home in the Six Nations.
"We need to have a good look at the last couple of weeks and improve on some of the very good stuff we're doing and improve on some of the stuff we need to get better at." Italy faces England at Twickenham before hosting France.
"We have to continue working, getting ourselves used to playing like this and at this level," Italy's Irish coach Conor O'Shea said. "If we continue to have performances of this level, the results will come.
"Unfortunately we made errors with some things that we could have controlled. Now we have a difficult match against England, but we are growing and we have to always play at this level, working on the things we can control."
There was little sign of what was to come from Italy in a sloppy start from the hosts and Ireland eventually took advantage of its opponents' indiscipline to take the lead in the 11th minute. Ireland built momentum and, although Chris Farrell was stopped just short of the try line, Roux managed to force his way over and Jonathan Sexton had the easiest of conversions.
Italy got on the board with a penalty from Allan but Ireland got its second try immediately after as mistakes from Leonard Ghiraldini, captain in place of the injured Sergio Parisse, and Campagnaro gifted the ball to the visitors and Stockdale sprinted forward to dot down.
That was to be the last points for Ireland in the first half as Sexton's kick went wide and Italy then threatened to pull off one of the greatest shocks in the tournament. The Azzurri scored their first try in the 33rd as Hayward burst through the Ireland defensive line and, although he was hauled down two meters from the try line, the ball was swiftly recycled by Tito Tebaldi to Allan and he threw a pass to an unmarked Padovani on the right for a simple score.
Tebaldi also had a hand in Italy's second try. With Ireland attacking, he managed to steal the ball and power down the field before kicking the ball for Padovani to chase. It was then spread quickly to the left and Morisi managed to power over the line.
Allan missed both conversions but it mattered little to the passionate home support in the Stadio Olimpico. Italy had last beaten Ireland in the 2013 Six Nations, when it also led at halftime but there was to be no repeat this time.
Ireland started the second half strongly and, after a long period of pressure close to the try line, Earls spotted a small gap with Murray converting to give Ireland a three-point lead. The visitors got the fourth try and the bonus point it desperately wanted shortly after the hour mark. Murray was at the back of a driving maul, and all he had to do was stretch and get the ball down.
Ian McKinley replaced Allan late on and the Ireland-born flyhalf's remarkable story almost reached another milestone but he kicked a penalty wide as Italy sought a losing bonus point. During a club game in 2010, a teammate accidentally stood on McKinley's left eye and perforated the eyeball. He retired the following year after losing sight in the eye but returned to playing rugby in 2014 using specially manufactured goggles.
There were plenty of positives for Italy to take from the match. "We threw away a few crucial points but the guys were fantastic. I'm really proud," said Parisse, who had watched from the side of the pitch. "We have come out of this match with our heads held really high and it's confirmation we're going in the right direction. I'm super proud."
More AP sports: https://apnews.com/apf-sports and https://twitter.com/AP_Sports