Tyler Soderstrom homered and was 2 for 4 and Zack Gelof hit a double to take the lead in the eighth as the Athletics beat the Cubs 5-3, leading the Milwaukee Brewers to become the first major league team to earn a spot in the playoffs, on Wednesday.

Chicago’s loss clinches a playoff berth for the Brewers, who won the National League Central division for the third time in four years.

The 22-year-old Soderstrom scored two runs and batted in two more to help Oakland to a series victory over the Cubs. Brent Rooker was 2 for 3 with an RBI and a pair of walks.

Tyler Ferguson (4-2) picked up the win after throwing a hitless seventh inning, and Michel Otañez struck out two in the eighth. Mason Miller earned his 27th save of the year.

Batting in just his fourth game since returning from a left wrist injury, Soderstrom hit a home run in the fourth inning to mark his first long ball since June 28 and give Oakland the lead, 1-0.

The Cubs were held to just two hits through four innings, but finally connected in the fifth. With the bases loaded, Dansby Swanson and Seiya Suzuki hit RBI singles and Cody Bellinger’s sacrifice fly made it 3-1.

The streak of hits ended rookie pitcher Brady Basso’s day after 4 2/3 innings. He gave up three runs on six hits and two walks, but struck out five.

Soderstrom and Tyler Nevin each singled in the seventh, and Lawrence Butler and Brent Rooker brought them home to tie it up.

Zack Gelof’s RBI double in the eighth regained the lead for Oakland. Gelof advanced to third on the throw, putting him in position to score and take a 5-3 lead on a hard-hit grounder to second by Soderstrom.

Justin Steele had a short return to action in his first game back from elbow tendinitis, going just 2 2/3 innings.