Ramos, the 21-year-old striker for Benfica, scored the first hat trick of the tournament on his debut international outing to help Morocco advance to the quarterfinals after defeating Spain on penalties.
Following Ramos' 17-minute goal past Swiss goalkeeper Jan Sommer at the near post, Pepe extended Portugal's advantage in the 33rd minute. Six minutes after the half, Ramos effectively ended the game with a close-range swoop on a cross from Diogo Dalot, and four minutes later, Raphael Guerriero completed the sweeping play with a powerful goal.
Manuel Akanji gave Switzerland a goal back, but Ramos quickly added a third with a deft chip. Rafael Leao curled in the sixth for Portugal in extra time.