SAN FRANCISCO (AP) — Fernando Tatis Jr. hit his league-leading 39th home run and the San Diego Padres beat the San Francisco Giants 7-4 on Thursday to earn a series split and shrinking the Giants’ lead in the NL West division.

The Giants loss moves the idle Los Angeles Dodgers to one game behind the Giants. The division winner and the 1st NL wild card slot will come down to either the Giants and Dodgers, who have the two best records in the majors at 95-52 and 94-53, respectively.

READ MORE: UPDATE: Streets Flood in San Rafael, Mill Valley as Wild Storm Lashes Bay Area

The Padres moved within half a game of the idle Cardinals for the second NL wild card at 76-70. San Diego starts a three-game series in St. Louis on Friday.

Tatis also singled and walked twice a day after matching a career best with four hits. Tommy Pham and Manny Machado each drove in two runs, and Adam Frazier and Austin Nola had three hits apiece.

READ MORE: Atmospheric River: High Winds Topple Trees, Scaffolding in San Francisco

Evan Longoria homered for the NL West-leading Giants, whose lead over the Dodgers dropped to a game. Los Angeles was off Thursday.

Nabil Crismatt (3-1) pitched four scoreless innings in relief to earn the win in a bullpen game for the Padres.

Giants starter Kevin Gausman (14-6) lost for the first time since July 30, allowing four earned runs on eight hits in five innings.

MORE NEWS: Atmospheric River: More Than 147,000 Affected by Widespread Bay Area Outages

© Copyright 2021 Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed