Wawrinka lost his serve twice and won just more than one-third of the points in losing the first set but didn't drop serve after that in a 1-6, 6-3, 6-4 decision.
Wawrinka won 57 percent of the points after the first set and fought off all three break points Ramos had.
No. 3-seeded Andreas Seppi made quick work of Alejandro Fall for a 6-4, 6-0 win. He won nearly three-quarters of the points in the second set. He'll face eighth-seeded Tommy Robredo in the quarterfinals.
Robredo defeated Robin Haase 6-4, 6-4 with two breaks in each set.
Wild-card entrant Gastao Elias, the last Portuguese player in the field, took the other quarterfinal slot, beating Denis Istomin 3-6, 6-1, 6-4. His quarterfinal match will mark his first career meeting with Wawrinka.