Riley Greene hit an RBI double and the Detroit Tigers scored two runs on wild pitches in a 4-1 home win over the record-breaking Chicago White Sox on Friday night, clinching a spot in the playoffs for the first time in a decade.

Detroit completed a late-season surge to grab an American League wild card, and the White Sox earned an unwanted place in baseball history by setting a modern major league mark with 121 losses this season.

The Tigers (86-74) have been on a tear, winning six straight and 10 of 11 during a stunning run into the playoffs.

Detroit was 55-63 on Aug. 10 — 10 games out of the last wild card — and then went 31-11.

The White Sox broke the post-1900 record of 120 losses set by the New York Mets in 1962 during their first season. The overall record was set in 1899 by the Cleveland Spiders with a 20-134 record.

Detroit broke a scoreless tie in the fifth inning on Jake Rogers’ run when Jared Shuster was charged with a wild pitch even though the ball didn’t hit the dirt just below catcher Korey Lee’s glove. Matt Vierling followed with a sacrifice fly.

White Sox rookie Zach DeLoach hit his first home run in the sixth to pull his team within one.

Greene restored Detroit’s two-run lead with a double in the seventh and Chicago helped the home team’s cause again later in the inning when Fraser Ellard threw his club’s third wild pitch of the night.

BRAVES 3, ROYALS 0 >> Max Fried pitched three-hit ball over 8 2/3 innings and Atlanta blanked AL wild-card contending Kansas City.

Sean Murphy hit a two-run homer for the Braves, who began the night one game behind Arizona and the New York Mets in the NL wild-card race.

Fried (11-10) came within one out of a shutout, giving way to Raisel Iglesias when the Royals put runners at second and third. Iglesias retired Salvador Perez on a flyout for his 33rd save.

Fried walked two and struck out nine.

PIRATES 4, YANKEES 2 >> Bryan Reynolds homered twice, including a tiebreaking two-run drive in the eighth inning that lifted Pittsburgh over AL East champion New York at Yankee Stadium and delayed New York from clinching home-field advantage throughout the American League playoffs.

Jazz Chisholm Jr.’s two-run single put the Yankees ahead in the fifth inning but Nick Gonzales and Bryan Reynolds hit consecutive homers off Carlos Rodón in the the sixth.

NATIONALS 9, PHILLIES 1 >> Stone Garrett homered in his first major league plate appearance in more than a year in a three-hit, three-RBI effort and host Washington ended a four-game losing streak with a win over NL East champion Philadelphia.

Keibert Ruiz also drove in three runs for Washington, which beat Philadelphia for only the third time in 11 meetings this season.

Washington’s Trevor Williams (6-1) struck out five in five shutout innings and allowed three hits and two walks.