The New York Yankees wound up with an AL wild-card spot Saturday, beating visiting Toronto 2-1 on Aaron Judge’s 52nd home run shortly before Boston clinched the AL East.

New York needed two wins and two losses by Boston to force a tiebreaker Monday at Yankee Stadium. Instead, the Yankees will host the Minnesota Twins in the wild-card game Tuesday.

The wild-card winner will face the Indians in the best-of-five AL Division Series. Boston, which beat Houston about 20 minutes after the Yankees won, is set to take on the Astros in the playoffs.

Replacement starter CC Sabathia (14-5) won his fifth straight decision for the Yankees. The left-hander didn’t disappoint, allowing four hits and striking out six over 5⅔ shutout innings. The Yankees (91-70) improved to a season-high 21 games over .500.

Max Scherzer hurt

Washington Nationals ace Max Scherzer was pulled from his start while tuning up for the playoffs after an apparent injury to his right leg, and NL East champion Washington lost to the visiting Pittsburgh Pirates 4-1 Saturday night.

The Nationals didn’t immediately provide an update on Scherzer.

Scherzer, who leads the NL in strikeouts and is 16-6 with a 2.51 ERA, was preparing for the Nationals’ matchup against the Chicago Cubs in the best-of-five Division Series that begins Friday in Washington. But the two-time Cy Young Award winner stumbled on a 2-2 pitch to Josh Bell in the fourth inning, briefly hopped around the mound and bent over at the waist.

Washington manager Dusty Baker, pitching coach Mike Maddux and team trainers visited the mound and quickly took out Scherzer.

Romine does it all

Andrew Romine became the fifth player in baseball history to play all nine positions in one game, helping the Detroit Tigers beat the host Minnesota Twins 3-2 on Saturday night.

Romine, a 31-year-old utilityman, played catcher for the first time in his career and got one out on the mound. He was the first player to accomplish the feat since Shane Halter for Detroit against Minnesota on Oct. 1, 2000.

Tigers manager Brad Ausmus was Halter’s teammate in that game 17 years ago. He decided two years ago that the versatile Romine might be able to play each position, but the opportunity didn’t present itself until Saturday night, with the Tigers eliminated from playoff contention.

Cain calls it quits

Matt Cain raised his arms and waved his cap, fighting off tears amid a standing ovation as he walked off the mound for the last time.

Cain’s 13-year career came to an end with him pitching five shutout innings as the San Francisco Giants lost 3-2 to the San Diego Padres.

The home crowd saluted the right-hander, a cornerstone of the Giants’ championship era who pitched the only perfect game in franchise history. Cain took a curtain call and exited with a 1-0 lead.