SAN DIEGO (AP) -- A four-man shift by the Los Angeles Dodgers worked against San Diego Padres left-handed hitter Seth Smith.
A traditional infield against Yasmani Grandal did not.
Grandal singled in the winning run with two outs in the 12th inning and the Padres beat the NL West-leading Los Angeles Dodgers 3-2 Friday night.
Earlier in the inning, the Dodgers used a five-man infield, including a four-man shift against left-handed hitting Seth Smith, all stationed between first and second.
With runners on second and third and a 1-1 count to Abraham Almonte, the Dodgers brought in center fielder Andre Ethier to play first base, with Adrian Gonzalez playing between first and second. Almonte walked. The Dodgers then went to a four-man shift against Smith. He grounded to second baseman Dee Gordon, who forced Amarista at home.
"We haven't used it with everyone all on one side," manager Don Mattingly said. "Seth is a shift guy for us and if you have five guys, you just put four on that side. It's at that point of the game and you have to do it."
Grandal then singled to right on a 3-2 pitch to bring in Solarte with the winning run.
"We had a chance to get out of the inning," catcher A.J. Ellis said. "You have to throw a strike and he's got to put a swing on the ball and he found a hole."
Amarista started the winning rally with a single to left off San Diego native Kevin Correia (2-2). Yangervis Solarte walked with one out and both runners advanced on a wild pitch.
Tim Stauffer (5-2) pitched the 12th for the win.
The Dodgers' Hanley Ramirez hit a tying homer with one out the eighth and also had an RBI double among his three hits. Justin Turner also had three hits for the Dodgers, the sixth time in his last eight games that he's had multiple hits.
With the homer, Ramirez atoned for a painful baserunning slip-up two innings earlier. He hit a 2-1 pitch from Dale Thayer an estimated 390 feet into the middle deck on the Western Metal Supply Co. brick warehouse in the left-field corner to tie it at 2. It was his 13th.
Ramirez had a misadventure in the sixth, when he hit a leadoff single and slipped and fell while rounding the bag. He limped back to the bag, but Padres manager Bud Black called for a review. Replay showed that Ramirez was tagged out by Yasmani Grandal as he hopped toward the bag.
The Dodgers loaded the bases with two outs in the ninth before Dee Gordon hit into a force.
San Diego's Andrew Cashner pitched six strong innings but was left with his 10th straight start without a win since his last victory, April 16 against Colorado.
Cashner struck out eight and walked none while holding the Dodgers to one run and six hits. He was making his second start since returning from his second stint on the disabled list, a two-month stay due to a sore right shoulder.
Dating to June 11, 2013, Cashner has allowed two or fewer earned runs in 15 consecutive home starts.
Dan Haren also went six innings, allowing two runs, one earned, and five hits. He struck out three and walked one.
Rene Rivera hit a sacrifice fly for San Diego in the second. L.A. tied it on Ramirez's double in the third before San Diego went ahead on Alexi Amarista's RBI single in the fourth.
The Dodgers outfielder didn't start because Mattingly thought he seemed frustrated. Plus, Puig was 1 for 11 with four strikeouts against Cashner.
Puig pinch-hit for Dan Haren in the seventh and struck out against Nick Vincent to end the inning.
With three hits, the third baseman improved to .375 (30 for 80) with a home run, six doubles and 10 RBIs since the All-Star break. He improved to .362 (25 for 69) against the Padres.
Dodgers: Manager Don Mattingly said LHP Hyun-Jin Ryu will come off the disabled list and start Sunday's series finale.
Padres: SS Everth Cabrera, on the disabled list with a strained left hamstring, is feeling better and getting closer to being activated, manager Bud Black said.
In the middle game of the series Saturday night, Dodgers RHP Zack Greinke (12-8, 2.75) opposes San Diego RHP Ian Kennedy (10-11, 3.75). On June 12, 2013, Kennedy, then with Arizona, was one of six players and coaches ejected after a brawl with the Dodgers. Kennedy hit Yasiel Puig and Greinke with high pitches.