SAN DIEGO -- Rookie Francisco Mejia hit a grand slam with two outs in the ninth inning and the San Diego Padres rallied to beat the Texas Rangers 7-3 Sunday to avoid a three-game sweep in a matchup of last-place teams.
It was the first walkoff for Mejia, who was promoted from Triple-A on Sept. 4. The prized prospect has hit three homers since then.
The Rangers were two outs away from a 3-2 win and a three-game sweep before rookie Franmil Reyes hit a bloop single to right off rookie reliever Jeffrey Springs (0-1) and made way for pinch-runner Travis Jankowski. Freddy Galvisthen doubled to left to bring in Jankowski with the tying run.
Pinch-hitter A.J. Ellis walked as Galvis took third on a ball four-wild pitch. Cory Spangenberg walked to load the bases and bring up Mejia, who homered to left on the first pitch he saw.
Padres manager Andy Green was ejected in the top of the ninth after Robinson Chirinos appeared to hit the ball off the knob of his bat into fair territory. Padres reliever Trey Wingenter fielded the ball and threw to first. After the umps huddled and then went to a video review that lasted four minutes, 50 seconds, Green was ejected for arguing and Chirinos was awarded first on a hit-by-pitch.
The Rangers loaded the bases but failed to score.
Kirby Yates (5-3) got the last two outs of the ninth for the win.
The Padres had runners on first and third with no outs in the eighth and failed to score.
Rangers starter Mike Minor allowed two runs and four hits, struck out seven and walked one. He also doubled. Minor's only big mistake was allowing Hunter Renfroe's homer with two outs in the first, his 23rd.
Willie Calhoun homered with one out in the second, his second, and Jurickson Profar hit a leadoff shot in the third, his 18th. Both were off Padres rookie Jacob Nix, who also allowed Robinson Chirinos' RBI single in the sixth.
Nix allowed three runs and seven hits in six innings, struck out three and walked one.
Rangers: RHP Adrian Sampson (0-1, 5.06) is scheduled to make his second start with Texas when it opens a three-game home series against Tampa Bay on Monday night. The Rays will counter with RHP Tyler Glasnow (1-6, 4.48).