The American, who will retire when his run at the tournament ends, broke once to take the opening set 7-5.
Fognini took control of the second with a break, but the American broke back instantly to force the tie-break.
Roddick was dominant thereafter as he swept the Italian aside 7-1 thanks to some trademark booming serves.
The third was just as tight, but this time Fognini broke late before winning the set 6-4.
Both players were tentative at the start of the fourth, but Roddick finally made the breakthrough to go 4-3 ahead.
From there he managed to hold serve twice more to seal the win 6-4 and set up a last-16 clash with Juan Martin Del Potro.