The American seventh seed, a four-time semi-finalist here, was on court for three-and-a-half hours before winning, 6-7 (4/7), 6-4, 6-4, 7-6 (7/3) on Rod Laver Arena.
Roddick, who is now 8-0 for the new season after his lead-up Brisbane tournament victory, will now play Chilean 11th seed Fernando Gonzalez, a former finalist here.
"I feel fine," Roddick said. "I had a longer match today and I'm relieved to get through to the next round."
In a tight match, the American earned three service breaks and left-handed Lopez just one as both players probed for openings with patient long rallies.
But it was Roddick's greater groundstroke consistency that won through as the 46th-ranked Lopez committed 60 unforced errors to the American's 21.
Roddick stretched his record over Lopez to 6-0 with his first win over the Spanish Davis Cup player in a Grand Slam tournament.
Lopez's opening tiebreak set win was only his second against Roddick in their six matches.
The Spaniard edged Roddick in the opening set and wrapped up the tiebreaker 7/4 with a backhand cross court.
But after the early setback Roddick began to dominate more and broke Lopez in the fifth game of the second set when the Spaniard overhit a forehand.
Roddick broke Lopez's service in the ninth game to take the third set and clinched the match after a dominant fourth set tiebreaker.
Roddick is looking to go at least one stage better than his four losing semi-final appearances here against Rainer Schuettler (2003), Lleyton Hewitt (2005) and Roger Federer in 2007 and last year.