SAN DIEGO -- Jordy Mercer had four hits, including a homer, and Neil Walker drove in three runs Monday night as the Pittsburgh Pirates put 27 runners on base in a 10-3 victory over the San Diego Padres at Petco Park.

Mercer, who entered the game hitting .199 with one homer, opened the scoring with a homer leading off the second. The Pittsburgh shortstop followed with three singles and a walk to finish with four runs and two RBIs.

Pirates right fielder Josh Harrison and second baseman Walker each had three hits.

Walker was also twice hit by pitches as a total of six batters were hit by pitches in a game that also featured 12 walks. Three Padres and three Pirates were hit by pitches.

The Pirates finished with 16 hits, seven walks and three hit batters. They also had a runner reach on a passed ball after striking out.

In addition to scoring 10 runs, the Pirates stranded a season-high 16 baserunners in the longest nine-inning major league game ever played in San Diego -- 4 hours, 4 minutes.

Right-hander Charlie Morton (2-7) was credited with the win, allowing three hits, three walks, three hit batters and two runs in five innings. He also had nine strikeouts as the Pirates scored their fourth win in five games.

The Pirates took a 2-0 lead in the third inning as Padres right-hander Tim Stauffer (2-2) again struggled as a starter.

Mercer, who snapped out of a 0-for-21 drought with two hits Saturday, opened the third with a 414-foot homer into the distant second deck in left at Petco Park. The home run was Mercer's second of the season.

One-out singles by Harrison and Walker and a walk to center fielder Andrew McCutchen loaded the bases for first baseman Ike Davis, who hit a sacrifice fly to left.

Left-hander Alex Torres came on to strike out left-handed third baseman Pedro Alvarez to end the inning.

Stauffer allowed two runs on four hits and two walks with four strikeouts in 2 2/3 innings. Over his past two starts, the long reliever-turned-starter gave up nine runs on 10 hits and three walks in a total of three innings.

The Pirates upped their lead to 3-0 on Mercer's RBI single in the fourth.

The Padres scored twice in the fifth and had the bases loaded with two out when Pirates Morton stuck out pinch hitter Tommy Medica.

Although they had five baserunners in four innings, the Padres didn't have a hit until center fielder Alexi Amarista opened the fifth with a single to right. Shortstop Everth Cabrera doubled to left center to scored Amarista. Left fielder Seth Smith singled home Cabrera.

Singles by Mercer, pinch hitter Travis Snider and Walker upped the Pirates' lead to 4-2 in the sixth.

Pittsburgh added three runs in the seventh and another three in the eighth.

NOTES: Padres RHP Andrew Cashner threw a 65-pitch simulated game at Petco Park on Monday afternoon, and he is scheduled to start over the weekend against the Nationals. Cashner has been on the disabled list since May 17 with soreness in his right elbow and forearm. ... The Padres recalled RHP Jesse Hahn, 24, from Double-A San Antonio to make Tuesday's start against the Pirates. ... Pirates manager Clint Hurdle said RHP Brandon Cumpton (0-2, 6.85 ERA in four starts) could be skipped from his next start. ... Pirates RHP Stolmy Pimental, on the disabled list since May 2 with right shoulder inflammation, is set to start a rehab assignment with Class A Bradenton. ... The Padres sent Triple-A RHP Jorge Reyes to the Braves for cash considerations. ... San Diego 1B/OF Tommy Medica (sore quadriceps) and CF Cameron Maybin (calf) are both day-to-day.