MIAMI -- Jeff Mathis stood at the plate confronted by five infielders and knew what he had to do: get the ball past them.
He did, and then some, hitting a grand slam with one out in the ninth inning Sunday that lifted the Miami Marlins over the San Diego Padres 6-2.
With the score 2-all and the bases loaded, the Padres deployed a five-infielder, two-outfielder defence for Mathis. He pulled a 1-0 pitch past everyone and into the Padres bullpen.
"I appreciated being in that position and enjoyed every minute," Mathis said. "It's one of those ideal situations. You really want to get the job done. It was a bunch of fun."
The 3,000th homer in the franchise's 20-year history came from an unlikely source. Mathis is a career .195 hitter, and this year he's batting only .129 after missing almost all of spring training because of a broken collarbone.
The victory added momentum to the Marlins' turnaround of late. While they still have baseball's worst record, they went 15-10 in June, a huge improvement on their 14-41 record in the first two months.
"After April and May, to do what we did in June is great," manager Mike Redmond said. "Are we happy? Yes. Are we satisfied? No."
Logan Morrison walked to start the ninth-inning rally against Tyson Ross (0-4), who looked back on that moment as pivotal.
"That leadoff walk killed me," Ross said. "It can't happen in the ninth inning, or any inning really."
Morrison took second on a single by Marcell Ozuna, then advanced to third on a flyout. Pinch-hitter Greg Dobbs was intentionally walked to load the bases, and Mathis followed with his second home run of the year.
It was also Mathis' second career grand slam, and his first walkoff homer. Gleeful teammates greeted him at home plate, and he joined the scrum leading with his left shoulder.
"I knew I was going to get pounded on, so I was getting ready for it," he said. "The adrenalin was going pretty good."
Nathan Eovaldi threw six shutout innings for Miami, and Steve Cishek (2-4) pitched a hitless ninth. The Marlins made the most of their seven hits.
"We gave ourselves a chance, got some big hits and had some big at-bats, something we weren't doing early in the season," Redmond said. "I just felt like we were going to win that game in the ninth."
Padres pinch-hitter Carlos Quentin tied the score with a two-run homer in the seventh off Chad Qualls following a four-pitch walk to Yasmani Grandal.
Eovaldi, making his third start since coming off the disabled list, struck out none but departed leading 2-0.
"When I was attacking, they were putting the ball in play and the defence was there," Eovaldi said. He missed the first 2 1/2 months of the season because of right shoulder inflammation.
The Padres' Andrew Cashner, plagued lately by poor run support, allowed five hits and two runs in six innings.
"Today was probably the best I've thrown all year," Cashner said. "I couldn't get a couple of plays to go my way, but overall I think I did really well."
Cashner displayed his all-around ability at the plate and in the field. He bunted for a hit to lead off the third inning, and in the fifth he went to his knees to field a tapper by Eovaldi, then rose, ran and slid into first for an unassisted putout.
"I probably made the best play of my career," Cashner said.
Quentin, held out of the starting lineup to give him a breather, batted for Cashner in the seventh and hit his ninth homer on the first pitch from Qualls. Quentin had been 0 for 6 as a pinch hitter this season, and it was his third career homer in that role.
"Any time a guy hits a pinch-hit home run, that shocks you a little," Redmond said. "So I think it took us a couple of innings to get over that."
NOTES: Padres 2B Jedd Gyorko (strained right groin) plans to take part in drills Monday but is expected to be sidelined at least a few more days. ... As part of the Marlins' celebration of its 20th anniversary season, several ex-players attended the game, and Jeff Conine threw out the ceremonial first pitch to Charles Johnson. ... The Padres fell to 5-1 under manager Bud Black on his birthday. He turned 57 Sunday. ... RHP Jason Marquis, scheduled to start Monday's series finale, is 7-6 with a 5.67 ERA in 23 games against the Marlins.