Portugal coach Fernando Santos took the brave call to bench Cristiano Ronaldo and was rewarded with an artful display from his side as they set up a last-eight clash with Morocco, who stunned Spain in a penalty shootout earlier in the day.
Ramos, making his first start at the World Cup, gave Portugal the lead in the 17th minute after latching onto Joao Felix's pass and smashing the ball past Swiss goalkeeper Yann Sommer at his near post from an acute angle.
The 21-year-old Benfica striker scored his second, and Portugal's third, six minutes after the break by getting onto the end of Diogo Dalot's low cross and he completed his hat-trick in the 67th with a delicate dinked finish.
Pepe had doubled Portugal's lead with a powerful header from a Bruno Fernandes corner after 33 minutes and Raphael Guerreiro rifled in their fourth in the 55th before Rafael Leao completed the rout in added time with a curled finish.
Manuel Akanji scored a consolation goal for the Swiss from a corner just before the hour.