Rudi Garcia's men fell behind to an opener within the first minute on Saturday but came roaring back with two goals before the break to snatch the three points
The Giallorossi went into the game knowing victory would move them level on points with Serie A leaders Juventus ahead of their late kick off against Lazio.
But Rudi Garcia's men got off to the worst possible start when Moralez finished superbly after Cristian Raimondi had twisted and turned past Ashley Cole before finding the Argentine inside the 18-yard box.
To Roma's credit, they stuck to their task and were on level terms on 23 minutes when Ljajic cut inside and produced a smart finish inside the box, before Nainggolan found the back of the net just before half-time to seal the win.
Daniele Baselli then rattled the woodwork again as his drive from distance spared Morgan De Sanctis for his error from a cross.
Ljajic drew Roma level in some style, however, cutting inside and firing into the bottom corner following a strong run from deep from Miralem Pjanic.
And Ljajic helped the Giallorossi to take the lead shortly before the break, setting up Nainggolan on the break to sidefoot home from inside the area.
Atalanta increased the pressure in the second half, with Moralez twice coming close, but Roma ultimately held on for maximum points as Richmond Boakye saw red late on following a second booking for dissent.