The scores were 7-6 (7-2), 7-6 (7-2), 4-6, 6-3.
Roddick, a former world No. 1 and the last American left in the field at the All-England club, won the match with 33 service aces to 26 for Melzer. Both had two service breaks.
Roddick meets Tomas Berdych of the Czech Republic in the fourth round. Berdych beat Russia's Nikolay Davydenko 6-2, 6-3, 6-2.
In other action, unseeded Lleyton Hewitt of Australia, also a former world No. 1, beat Germany's Philipp Petzschner 7-5, 7-6 (7-3), 6-3; Germany's Tommy Haas downed No. 11 seed Marin Cilic of Croatia 7-5, 7-5, 1-6, 6-7 (3-7), 10-8 in a suspended match from Friday; and Czech Radek Stepanek beat No. 16 David Ferrer of Spain 7-5, 7-5, 3-6, 4-6, 6-4.
"I think this was one of my best matches this year," Hewitt said.
Other winners were Switzerland's Stanislas Wawrinka and Russian Igor Andreev.
Ray Liotta sues skin care company over use of likeness
Boston schools pull out free condoms over wrapping complaints