Raonic, the No. 10 seed from Thornhill, Ont., was never troubled after losing a 52-minute first set. He began the second set with a break and looked more confident the rest of the way, completing the win in two hours 37 minutes.
"It was good, but I felt really like I was struggling just in the beginning just to figure things out," Raonic said. "After I started doing things well I wasn't making too many unforced errors.
"I was coming forward. I was a little bit sloppy at the net at times. I wasn't taking care of the opportunities I had there. I started cleaning things up from the baseline. I was pretty sound and served pretty well, and the return was getting better and better throughout the match."
Raonic, who lost to Britain's Andy Murray in the fourth round here last year, had 28 aces while Lopez managed only seven.
"It was humid today and it slowed things down quite a bit," Raonic said. "The humidity was much worse than the heat. I think I went through five or six shirts.
The 22-year-old Canadian will next play No. 8 seed Richard Gasquet of France.
Raonic also reached the fourth round at the Australian Open earlier this year and in 2011.
Lopez beat Raonic in their only previous meeting. The Spaniard recorded a three-set win on clay in the first round of the Madrid Masters in 2011.
Raonic was never troubled after he lost a long 52-minute first set to his Spanish opponent after Lopez saved a set point in the 12th game.
Raonic began the second set with a break and quickly went on to level at a set apiece before pulling away.
"I feel like I'm playing well," he said. "If I continue playing the way I am, I will have a lot of opportunities to give myself in each set to win a match."
Raonic is the last Canadian in the singles draw. Toronto's Daniel Nestor and Vernon, B.C., native Vasek Pospisil are scheduled to play the top-seeded American duo of Bob and Mike Bryan on Sunday in third-round men's doubles play.