Lucas Digne's long-range stunner gave Luciano Spalletti's side the lead, but they were pegged back by Kevin Lasagna just five minutes later.
Dzeko – whose last goal in Serie A came in November – turned home Mohamed Salah's cross after 84 minutes and the Egypt international went on to make the points safe, with Nainggolan now hoping to see the former Manchester City striker regain some confidence.
READ MORE | Real Madrid not on Spalletti's mind
"It was difficult until Lucas Digne's goal, as we had the game in our hands despite not creating many scoring opportunities," the midfielder told Mediaset Premium.
"The victory was deserved and we'd been waiting a really long time for Dzeko's goal. I'm happy that he ended his drought. At this moment he really needed this goal, because he was a bit down."
Roma's win moved them into third in the table ahead of Inter's clash with Fiorentina on Sunday and Nainggolan is determined to continue their strong recent form which has seen them win four games in a row.
"We have to put together a run of victories if we're to stay close to the leading group, because everyone else is doing really well," he added.
"Our objective for the season was always to challenge for the top spots. Right now it's third place, then if those above us drop points it's up to us to catch them."