MIAMI — The Miami Marlins' homestand ended with a mob scene around Brian Anderson at second base that included punches on the arm, slaps on the back, hugs and high-fives.
It's a wonder the Marlins remembered how to celebrate ninth-inning heroics, because they haven't had many.
Anderson doubled home the winning run with one out in the ninth, and the Marlins earned their first walkoff victory of the year by beating the San Diego Padres 4-3 on Thursday.
"That was a lot of fun right there," Anderson said. "Being able to finally get it done for the team feels great."
Miami was 1 for 13 with runners in scoring position before Anderson came through.
The score was 3-all when Garrett Cooper singled with one out in the ninth against Trey Wingenter (1-3). Pinch runner Yadiel Rivera stole second and scored without a play after third baseman Manny Machado barely missed a diving try at a backhanded stop of Anderson's liner into the corner.
"I was able to sneak it past him," Anderson said.
Fernando Tatis Jr. hit his 15th home run for the Padres, who were hurt by sloppy defence and struck out 15 times.
Sergio Romo (2-0) had two strikeouts in a perfect ninth. Teammate Harold Ramirez hit his fourth homer.
Miami, which has the worst record in the National League, won two of three from the Padres. The Marlins went 1-10-3 in the series through May 15, and since then they're 8-8-1.
"We're in every game," Miami manager Don Mattingly said. "We've talked about how it's time for us to win close games. That's where we're going to move forward."
San Diego fell to 1-5 since the All-Star break.
"Not a good game, not a good series for us," manager Andy Green said. "We weren't fundamentally sound, and we didn't deserve to win this series. We made a lot of mistakes on the defensive side of the ball, and didn't create enough offensive opportunities."
The Marlins scored two unearned runs in the second after catcher Austin Hedges made an errant throw on a sacrifice bunt. The bunt appeared to be foul, but Green shrugged off the questionable call.
"It was an easy double play, and we didn't do it," he said.
Miami had the better defence. A leaping catch at the wall by centre fielder Cesar Puello robbed Hunter Renfroe in the fifth.
Marlins starter Caleb Smith gave up two runs in five innings. San Diego's Dinelson Lamet allowed three runs, one earned, in four innings.
"It was a full team win," Anderson said. "We played good defence all day. Smitty is back, doing his usual thing, giving us a chance every time, and our bullpen was great."
Tatis was 0 for 10 in the series with seven strikeouts before he homered to centre field in the fifth. He also committed a throwing error, his third in two days, but Green said the rookie shortstop's defence isn't a concern.
"He's going to be completely fine," Green said. "He just hasn't been crisp the past few days."
Tatis didn't talk to reporters after the game.
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.
MAKING SOME NOISE
Attendance on camp day was 21,149, including more than 12,000 youngsters who provided a steady din, a rarity at Marlins Park. The crowd was the largest since opening day.
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.
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