Brian Anderson doubled home the winning run with one out in the ninth inning, and the Miami Marlins earned their first walkoff victory of the year by beating the San Diego Padres 4-3 on Thursday.

The score was 3-all when Garrett Cooper singled in the ninth against Trey Wingenter (1-3). Pinch runner Yadiel Rivera stole second and scored without a play on Anderson's hit into the left field corner.

The Marlins were 1 for 13 with runners in scoring position before Anderson came through.

San Diego Padres catcher Austin Hedges talks at the mound with pitcher Dinelson Lamet (29) in the first inning of a baseball game against the Miami Marlins, Thursday, July 18, 2019, in Miami. (AP PhotoJim Rassol)

San Diego Padres catcher Austin Hedges talks at the mound with pitcher Dinelson Lamet (29) in the first inning of a baseball game against the Miami Marlins, Thursday, July 18, 2019, in Miami. (AP PhotoJim Rassol)

Five Marlins pitchers combined for 15 strikeouts. Sergio Romo (2-0) had two strikeouts in a perfect ninth.

Fernando Tatis Jr. hit his 15th home run for the Padres. Miami's Harold Ramirez hit his fourth homer.

The Marlins, who won two of three against San Diego, went 1-10-3 in the series through May 15. Since then they're 8-8-1.

San Diego Padres' Dinelson Lamet pitches in the first inning of a baseball game against the Miami Marlins, Thursday, July 18, 2019, in Miami. (AP PhotoJim Rassol)

San Diego Padres' Dinelson Lamet pitches in the first inning of a baseball game against the Miami Marlins, Thursday, July 18, 2019, in Miami. (AP PhotoJim Rassol)

San Diego fell to 1-5 since the All-Star break.

Attendance on camp day was 21,149, including more than 10,000 youngsters who provided a steady din, a rarity at Marlins Park. The crowd was the largest since opening day.

Miami starter Caleb Smith gave up two runs in five innings. San Diego's Dinelson Lamet allowed three runs, one earned, in four innings.

The Marlins scored two unearned runs in the second. One came home when catcher Austin Hedges made an errant throw on a sacrifice bunt, and another scored on Neil Walker's two-out double.

Padres pinch hitter Francisco Mejia's two-out RBI single in the sixth made it 3-all.

Tatis was 0 for 10 in the series with seven strikeouts before he homered to center field in the fifth. The young shortstop also committed a throwing error, his third in two days.

Miami had the better defense. A leaping catch at the wall by center fielder Cesar Puello robbed Hunter Renfroe in the fifth.

WHAT RELIEF

Padres rookie Andres Munoz kept the score tied with two scoreless innings and topped out at 102 mph. He gave up a leadoff double to Cooper in the seventh and then struck out the side.

TRAINER'S ROOM

Padres: RHP Garrett Richards made his first rehab start in his return from Tommy John surgery, allowing one run with three strikeouts in two innings in the Arizona Rookie League.

Marlins: Before the game, they placed INF/OF JT Riddle (right forearm strain) on the 10-day injured list and reinstated 3B Martín Prado (right hamstring strain) from the IL. Prado had been sidelined since June 12.

UP NEXT

Padres: LHP Eric Lauer (5-7, 4.04) is scheduled to start Friday when San Diego opens a three-game series at the Cubs.

Marlins: Rookie RHP Zac Gallen (0-1, 4.24) is scheduled to make his fifth career start when Miami opens a six-game trip Friday at the Dodgers. Miami is 13-13 against Los Angeles since 2015.

More AP MLB: https://apnews.com/MLB and https://twitter.com/AP_Sports

Follow Steven Wine on Twitter: http://twitter.com/Steve_Wine