Portugal coach Fernando Santos now has to decide whether to stick with Ramos or restore Ronaldo, the top scorer in men's international soccer and one of the game's greatest ever players.
Ronaldo had a couple of chances after coming on, and even thought he had scored when he ran through and drove a low shot past Switzerland goalkeeper Yann Sommer. The goal was disallowed for offside, much to the irritation of the fans - Portuguese or from other countries - who had come to see him.After the final whistle, as Portugal players stayed on the field to applaud the team's fans at one end of the stadium, Ronaldo walked off on his own - perhaps wondering where his career goes from here. He is currently without a club after leaving Manchester United midway through the World Cup.
Ronaldo was dropped a day after Santos expressed his unhappiness at the striker's attitude after he was substituted against South Korea in the team's final group game.
Ramos was a surprise replacement - he had previously only made three substitute appearances for Portugal - and took his chance.
Ramos, who was only 2 years old when Ronaldo made his Portugal debut in 2003, produced the first hat trick at this year's World Cup. He also did something Ronaldo has never achieved - score a knockout goal at soccer's biggest tournament.
Ramos drove a rising shot with his left foot inside Sommer's near post for the first goal, flicked deftly through Sommer's legs from close range for the second, and then ran through to chip the goalkeeper for his third.
Ronaldo was seen smiling while he was warming up on the side of the field after Ramos' second goal.
Ramos even had an assist, playing the ball through for Guerreiro to score the fourth goal.