The Americans' prospects of reaching the knockout round had looked dicey after losing to Canada a day earlier, but they dominated the Slovaks almost from the start.
Cole Bardreau opened the scoring in the fourth minute but Slovakia's Matus Matis equalized just 14 second later. The Americans gradually built up an insurmountable lead, helped by two goals apiece from Vince Trocheck and John Gaudreau.
In Group A, the Czech Republic beat Switzerland 4-3 in overtime. Tomas Hertl scored the game-winner on a pass off the backboards from Dmitrij Jaskin.
Group leader Sweden later defeated regional rival Finland 7-4, demoting Finland to the relegation round. Sweden went up 2-0 in the game's first seven minutes; Finland equalized at 3-3 in the second period before Sweden pulled away for good. Viktor Arvidsson had two goals for Sweden and Joel Armian scored twice for Finland.
Canada stayed atop Group B by downing Russia 4-1. Jonathan Huberdeau, Mark Scheifele, Dougie Hamilton and Jonathan Drouin scored for Canada. Russia's lone goal came from Nikita Kucherov in the 17th minute.
As group leaders, Canada and Sweden draw byes in Wednesday's quarterfinals, where the United States faces the Czechs and Russia plays Switzerland.