SAN FRANCISCO -- Vance Worley insists he never was a San Francisco Giants fan despite growing up just 90 miles north of AT&T Park in Sacramento.

After a second career complete game against them, the Giants don't think much of Worley, either.

The 26-year-old right-hander took an early cushion and ran with it Monday night, pitching his first career shutout in a wire-to-wire, 5-0 victory over the Giants in the opener of a three-game series.

"Everybody from the West Coast was out there tonight," Worley said of a gathering of about 30 family members from Sacramento and friends from Long Beach State, where he went to college. "I'm glad I gave them something fun to watch."

Left fielder Josh Harrison walked and scored in a four-run first inning, then homered in the second, highlighting a seven-hit Pirates attack that produced a second consecutive win and a seventh in 10 games since the All-Star break.

The Pirates, who scored all their runs in the first two innings, are 16-7 against the National League West this season.

Pittsburgh's early barrage came at the expense of Giants ace left-hander Madison Bumgarner (12-8), who failed in his attempt to become the major league's second 13-game winner. The loss was the fifth in a row for the Giants, who were coming off a three-game home sweep at the hands of the Los Angeles Dodgers.

"He's one of the elite pitchers in the game," Pirates manager Clint Hurdle said of Bumgarner. "Every once in a while, you're not going to have your 'A' game. I've seen him pitch a lot. I've never seen anything like this."

The defeat dropped the Giants (57-49) into a tie with the St. Louis Cardinals (56-48) for the second National League wild-card spot, with the Pirates (56-49) just a half-game behind.

Worley (4-1), who was coming off a 12-7 home win over the Dodgers, was perfect for four innings against the Giants and faced the minimum for seven innings. He allowed only four hits, the first three of which were singles, and one walk. He struck out three.

"Anytime you can get a couple of runs on the board, it takes a little of the stress off you," said Worley, who threw 100 pitches. "We got those four runs, then five. I just got rolling after that."

The first three baserunners Worley allowed -- singles by third baseman Pablo Sandoval in the fifth and center fielder Gregor Blanco in the sixth, and a walk to second baseman Joe Panik in the seventh -- were all erased on the bases, Sandoval and Panik on double plays, Blanco on a steal attempt.

"I loved the way when he got a baserunner, he made the pitches he needed to make. That was fun to watch," Hurdle said. "The one thing you can see, when our pitcher is throwing strikes, the tempo of the game just picks up and our defense makes plays."

Giants manager Bruce Bochy was not happy with Blanco's steal attempt, which came in the sixth inning with San Francisco trailing 5-0.

"I guess he thought he was going to make something happen," Bochy said. "There was nothing on, I can tell you that."

Sandoval also singled in the eighth, giving him two of San Francisco's four hits. Right fielder Hunter Pence had a two-out triple in the ninth.

Harrison and shortstop Jordy Mercer had two hits apiece for the Pirates.

Bumgarner threw 22 pitches before recording his first out in the fateful first inning, and even that pitch cost him a run.

The Pirates loaded the bases with no outs in the first on a single by Mercer sandwiched between walks to Harrison and center fielder Andrew McCutchen. First baseman Gaby Sanchez's sacrifice fly on Bumgarner's 22nd pitch made it 1-0.

After second baseman Neil Walker singled home Mercer to make it 2-0, Bumgarner hurt his own cause by throwing low to second base after having McCutchen picked off. The All-Star scored one pitch later when catcher Russell Martin grounded an RBI single to center field for a 3-0 lead.

Right fielder Gregory Polanco's sacrifice fly made it 4-0 before Bumgarner retired third baseman Brent Morel to end the inning on his 42nd pitch, the most he ever threw in one inning.

Harrison's home run came with one out in the second, a solo shot to left that was his seventh of the season.

Bumgarner retired eight of the nine batters he faced after the homer, then left trailing 4-0 after completing four innings. He gave up five runs on six hits and two walks in his shortest stint since Opening Day. He struck out a season-low two.

The loss was the Giants' 20th in their past 26 home games.

"With the support we have, it shouldn't happen," Bochy said of the terrible home stretch. "And that's what's got me buffaloed. All of us."