Ryan Leonard grinned through the battle scars and boos Thursday at Canadian Tire Centre.

“It’s a quarter-final, win or lose and go home,” the captain said after the United States defeated the Swiss 7-2 to advance to Saturday’s semis of the world junior hockey championship. “So you’ve got to put everything out there, including my face. Whatever you’ve got to do, whatever it takes to win.”

Leonard, who scored twice in the victory, wound up with a swollen nose from an errant puck and a paddle as the Americans’ player of the game as a souvenir.

In acknowledgment of his strong performance, the Washington Capitals’ first-round pick in the 2023 National Hockey League draft was booed by many in the crowd of 12,772 on hand for the afternoon tilt.

“I liked it,” Leonard said of the reception from the fans. “It made me smile. Nice.”

James Hagens also scored twice for the Americans, while Brandon Svoboda, Danny Nelson and Zeev Buium added singles. Nils Rhyn and Andro Kaderli scored for the Swiss.

The U.S. rested No. 1 goalie Trey Augustine and gave the start to backup Hampton Slukynsky, a fourth-round pick of the NHL’s Los Angeles Kings.

The Americans outshot the Swiss, 31-19.

Meanwhile, Sweden remained unbeaten by ending the pesky Latvians’ run by a 3-2 count at TD Place.

Sweden had a 3-0 lead midway through its game before Eriks Mateiko, the hero of Latvia’s preliminary-round win over Canada, scored two second-period goals to make things interesting.

Sweden, which outshot Latvia 50-13, held an 18-2 edge in the third period, but, as was the case against Canada, Latvian goalie Linards Feldbergs turned in a sensational performance.

In the relegation game, also at CTC, Germany defeated Kazakhstan 4-3. Kazakhstan’s place in next year’s world juniors will be taken by Denmark.

It was still too early to tell what semifinal matchups would be on the weekend as re-seeding will be done following the Finland-Slovakia and Czechia-Canada games scheduled to start at 5 p.m. and 7:30 p.m., respectively, on Thursday.

The semifinals will be held on Saturday, leading into Sunday’s medal games. All weekend showdowns will be played at CTC.