In support of starter Ryan Vogelsong, Pagan fell a home run shy of hitting for the cycle while scoring two runs. The speedy center fielder has now scored two or more runs in five of the last six games and has scored in eight of the last nine.
"It's been amazing," Vogelsong said of Pagan's recent play. "It has definitely been a huge lift that we needed. He's definitely been our spark plug, and it's been fun to watch."
The Giants came back from an early two-run deficit, and Vogelsong rebounded after struggling in his two previous outings by allowing three runs on four hits in 6 1/3 innings. Vogelsong gave up solo home runs to Jason Heyward in the first and Freddie Freeman in the second, but the Giants evened the score after Pagan scored on Pablo Sandoval's double and Sandoval scored on a wild pitch.
"The first home run, I thought, was right in the middle of the plate," Vogelsong said. "The second one was a first pitch, a two-seamer away, and it was running away. He just put a good swing on it. They're both pretty big, strong guys, and if they get the barrel on it, it's going to go a long way. I'm just glad we were able to come back and score some runs and get the win."
After Pagan's go-ahead triple in the fourth, Marco Scutaro drove him in with a soft line drive for a single. The Giants got another run in the sixth when Buster Posey doubled home Scutaro as the All-Star catcher returned from sitting two games with a tight right hamstring.
The Giants' five-game winning streak matches the best of the season, and they are also now a season-best 16 games above .500.
"They're playing great," Freeman said. "They are not making mistakes defensively or offensively."
Vogelsong credited shoring up his mechanics for the solid outing after watching video of himself from his past two outings with pitching coach Dave Righetti, specifically being mindful of his release. He departed in the seventh inning with one out after allowing another Freeman home run and a Brian McCann single to left.
"I just felt like my direction to home plate needed to get better," Vogelsong said. "I felt like I was swinging off the ball a little bit the last few games, and I was showing the ball maybe too early. I just really tried to work on getting some better direction to the plate and hide the ball a little bit longer."
Pagan opened the eighth inning with a ground ball up the middle on a quick, short swing despite knowing he was a long ball away from hitting for the cycle.
"I'm not a selfish person; I wanted to get on base again," Pagan said. "I wanted to get there with the 5-3 game. Why would I [try to] homer? If I can get on base, I could try and make something happen and keep scoring runs."
Winners of seven of their last eight and 10 of their last 13, the Giants got hits from all eight of their starting position players for the second straight game.
"We've talked about this, getting production from everybody and getting timely hits," manager Bruce Bochy said. "From this point on, it can't be one or two guys. It's going to have to be everybody, and they're all doing a great job."