Mercer hit a go-ahead single with two outs in the ninth inning and the Pirates beat the Seattle Mariners 4-2 on Wednesday.
Mercer has come up big for the Pirates in several clutch situations. He's batting .391 with runners in scoring position with a home run, six RBIs and three walks.
"I guess I have a knack for coming up with big hits in big spots," Mercer said.
The Pirates improved to 48-30 -- they are 18 games over .500 for the first time since 1992, their last winning season. With the victory, Pittsburgh wraps up a 7-2 road trip to Cincinnati, Anaheim and Seattle.
"It was a good trip. Very good trip," manager Clint Hurdle said.
After a groundout by Gaby Sanchez, Travis Snider was intentionally walked. Mercer followed with an RBI single off Yoervis Medina, and the Pirates added an insurance run when a wild pitch on a third strike from Medina allowed Snider to score and Starling Marte to reach first base.
Mercer said he had a solid scouting report on Medina from the coaching staff and knew what to expect from the Mariners reliever.
"I was just looking to see something over the plate and put a good swing on it," Mercer said. "I gained a little confidence from the previous at-bat before when I singled to right. Just let it get deep and drive it up the middle or the other way and it worked out."
Mark Melancon earned his second save of the season. Mike Zunino delivered a pinch-hit single and Nick Franklin singled to put a pair of runners on with two outs in the ninth, but Kyle Seager grounded out.
Vin Mazzaro (4-2) picked up the victory with two innings of scoreless relief.
Hernandez bounced back to form after his worst start of the season. He blew a seven-run lead against the Los Angeles Angels in his last appearance, but struck out 11 against the Pirates. Hernandez gave up six hits and walked two.
"You've just got to battle him. You've got to battle him and try and get his pitch count up and stay in the game so you can get him out before it's the ninth inning," Hurdle said. "We were able to do that. He's always going to be tough. He competes very, very well out there and the sequence and the stuff he has makes it a very difficult day at the plate."
The Mariners squandered a chance to take the lead in the eighth. With the game even, Kendrys Morales doubled and the Pirates intentionally walked Ibanez to put a pair of runners on with one out. Mazzaro managed to escaped by striking out Justin Smoak and getting Michael Saunders to fly out.
"We've got to hit. It's time to hit," Mariners manager Eric Wedge said. "You're not going to win games unless you hit. They got the two-out hit. We didn't. Game over. That's the difference."
Walker hit his sixth home run, connecting with two outs.
Seattle managed to get a run back in the bottom half without a hit. Ibanez reached first after swinging at a third strike wild pitch that got away from catcher Russell Martin, then Smoak hit a grounder and Mercer mishandled the throw to second, the ball deflecting off the shortstop's glove.
Ibanez took advantage of the Pirates' defensive shift and advanced to a vacated third base on the misplay. A sacrifice fly from Saunders made it 2-1.
Jeanmar Gomez turned in a fine outing for the Pirates in his first start off the disabled list. He allowed just three hits and an unearned run in five innings with five strikeouts and threw the most pitches (81) of any outing this season.
"He gave us the innings we needed and got to the part of the game we're hoping to get to with the lead." Hurdle said. "He was effective again -- real nice job."
Ibanez tagged Justin Wilson for his ninth home run in June.
The Pirates optioned RHP Duke Welker to Triple-A Indianapolis in order to activate Gomez from the 15-day disabled list. ... Alvarez extended his hitting streak to 10 games. He's batting .390 with four doubles, five home runs and 13 RBIs over that span. ... Ibanez has just 12 hits against left-handed pitchers this season but six of the hits have been home runs. He is batting .214 with six home runs and 12 RBIs against lefties. ... Ibanez hit his ninth homer in June.