Jorge Soler extended his team record with his 40th homer, Hunter Dozier and Alex Gordon had three hits each, and the Kansas City Royals beat the Detroit Tigers 5-4 on Wednesday night.

The Royals are the last team in baseball history to have a player reach 40 home runs in a season. Prior to Tuesday, Mike Moustakas held the club record with 38 in 2017.

Jakob Junis (9-12) gave up four runs and seven hits over seven innings for Kansas City.

Ian Kennedy pitched the ninth for his 26th save in 30 chances. He blew his first save in 15 chances Tuesday night against Detroit, but he was perfect Wednesday.

Edwin Jackson (3-9) allowed four runs and nine hits in five innings for the Tigers.

Detroit scored three runs in the second inning on four consecutive hits. Christin Stewart led off with a single, Jeimer Candelario doubled and Harold Castro drove in both runners with a double. Castro then scored on a single by Dawel Lugo.

After threatening in the third, the Royals scored twice in the fourth. Dozier and Gordon singled leading off, and Ryan McBroom, who made his major league debut Tuesday, collected his first career RBI with a single that scored Dozier and sent Gordon to third. Gordon then scored on a wild pitch.

The Royals added two more in the fifth. Soler’s blast off the Royals Hall of Fame in left field tied it. Dozier then tripled off the base of the wall in left center and scored on Gordon’s infield hit.

Adalberto Mondesi hit a two-out single in the sixth to make it 5-3.

Miguel Cabrera’s RBI single just inside the line in the eighth cut the lead to one