The hosts led 16-12 at the break but Keith Earls put Ireland ahead 11 minutes into the second half before Conor Murray dived over to give the visitors their all-important fourth try.
Joe Schmidt's Ireland side earned a bonus-point win that leaves them third in the standings on nine points, one point behind England and three adrift of leaders Wales.
Ireland started strongly when Quinn Roux and Jacob Stockdale crossed either side of a Tommaso Allan penalty for Italy, who rallied as tries from Edoardo Padovani and Luca Morisi combined with another Allan penalty gave them the halftime lead.
Women's Six Nations Championship
Griggs wants more despite huge Ireland victory
"The bottom line is the win and the bonus point," said Schmidt. "We will go home happy with the points haul but not the performance. Credit to Italy, they made it very tough at the ruck area and put us under pressure."
"We know how difficult it is to come to Rome,” added man of the match Peter O’Mahony after captaining Ireland for the first time. “It's an incredibly physical battle and they are a super rugby team. They put us under the pump and we expected that.
"There is certainly stuff we can do better, and I know a lot is expected of us, but five points away from home is good because it is difficult to win on the road in the Six Nations."
The visitors posted the first points of the game after 12 minutes when Roux finished off a 19-phase move by powering over the line from close range, Jonathan Sexton adding the extras.
Allan responded with a penalty after Ireland were pinged for not releasing, but Italy were punished from the restart when Michele Campagnaro failed to collect a loose ball and Stockdale gathered to race through and dot down his ninth try in eight Six Nations games, Sexton then kicking his conversion wide.
Another penalty from Allan, for offside, cut the deficit before Padovani touched down Italy’s first try after 33 minutes following a superb break as full-back Jayden Hayward took them to the try line before the ball was worked out to the winger.
The Italians took the lead for the first time a minute before the interval. Scrum-half Tito Tebaldi pinched the ball at the breakdown and launched a counter-attack that was finished by centre Morisi powering past Chris Farrell to cross, although Allan missed his conversion for the second time.
Ireland responded 10 minutes into the second half when Earls dodged a couple of tackles to dive over the line, with Murray adding the extras from the kicking tee.
Murray then scored and converted a vital fourth try for the Irish in the 67th, dashing over the line from the back of a maul to open a 10-point cushion that the Italians could not reduce.
Italy's Dublin-born substitute Ian McKinley missed a penalty from the kicking tee at the death as the hosts tried to secure the consolation of a losing bonus point.
Italy are without a Six Nations win since beating Scotland in 2015, a Championship record run of 20 losses in a row, while their last home victory came against Ireland in 2013.
They remain rooted to the bottom of the table with three defeats from three games and no bonus points on the board.
The Azzurri now face England at Twickenham and then host France in the final two weeks of the tournament, while Ireland are at home to France next before finishing away to Wales.
Women's Six Nations Championship
England produce second-half masterclass in Italy thrashing in Women's Six Nations
Scotland produce record-breaking win over Italy