PITTSBURGH (AP) — Jeremy Hellickson was under the weather, though still good enough to end his road woes.

Hellickson won on the road for the first time in 2 ½ months and Jake Lamb homered to lead the Arizona Diamondbacks to a 4-1 victory over the Pittsburgh Pirates on Monday night.

Hellickson (9-8) allowed one run and three hits in 5 1-3 innings while striking out four and walking one. He had gone 0-4 with an 8.67 ERA in his previous six road starts since winning May 30 at Milwaukee.

Diamondbacks manager Chip Hale lifted Hellickson with two on and one out in the sixth inning when the right-hander's gluteus muscle began tightening because of dehydration.

"It shows what type of pitcher he is, especially here as hot and humid as it is," said Diamondbacks reliever Addison Reed, who escaped a bases-loaded jam in the seventh inning to protect the 4-1 lead.

"It's tough enough to pitch in a place like San Diego, where the weather is perfect. When it's hot, you're losing a lot of fluids and a guy isn't feeling good . it's a great job by him."

Lamb connected for his fifth home run in the fourth inning, a solo shot off Gerrit Cole (14-7) that put the Diamondbacks ahead 4-0 and helped snapped the National League wild card-leading Pirates' four-game winning streak.

David Peralta had two hits for the Diamondbacks, including an RBI double in a two-run first inning. He is hitting .462 (30 for 65) with 21 RBIs in his last 19 games.

Cole gave up four runs and nine hits in 6 2-3 innings with one walk and five strikeouts. He entered August leading the majors in wins but is 0-3 with a 4.70 ERA in four starts during the month.

"That's a good offensive club," Pirates manager Clint Hurdle said. "We made some mistakes over the plate. They were able to put the barrel on some balls early."

Cole's four starts without a win matches the longest drought of his three-year career, from April 15-May 2, 2014.

The Pirates had their lead in the wild-card race cut to two games over the idle Chicago Cubs. The Diamondbacks improved to 14-8 in their last 22 games.

Brad Ziegler pitched a scoreless ninth for his 21st save.

Pedro Alvarez accounted for the Pirates' lone run with his 19th homer in the fifth inning. He had two hits.

The Diamondbacks jumped on Cole for two runs in the first. A.J. Pollock tripled with one out and scored on Peralta's double before Welington Castillo capped the inning with an RBI single.

"He's one of the best pitchers in the game and he has one of the best fastballs," Lamb said. "We were aggressive with the fastball and able to string some hits together in that first inning."

Chris Owings hit a leadoff double in the second and scored on a single by Hellickson to push the lead to 3-0.

TRAINER'S ROOM

Diamondbacks: RHP Randall Delgado was activated from the 15-day disabled list after being out since July 28 with a sprained right ankle. He retired both batters he faced in the sixth inning in relief of Hellickson. INF/OF Jamie Romak was optioned to Triple-A Reno.

Pirates: 1B/OF Corey Hart, who has been on the disabled list since June 22 with a left shoulder impingement and right knee discomfort, is scheduled to begin a second rehab assignment Thursday with Triple-A Indianapolis. He was with Indianapolis from June 30-July 11 before experiencing a setback.

CLEANING UP

Peralta has proven to be an effective cleanup hitter, batting behind All-Star first baseman Paul Goldschmidt in the Diamondbacks' lineup. Peralta has a .339 batting average in 192 at-bats as the cleanup hitter, compared to .262 in his other 141 at-bats.

MILESTONE HOMER

Alvarez's home run was the 1,000th hit by the Pirates at PNC Park, which opened in 2001. His 58 career homers at PNC Park are third behind Andrew McCutchen's 70 and Jason Bay's 61.

UP NEXT

Diamondbacks: RHP Chase Anderson (5-5, 4.31 ERA) starts Tuesday night after losing his previous start last Wednesday against Philadelphia, when he allowed five runs in five innings.

Pirates: LHP Francisco Liriano (8-6, 3.19 ERA) is 4-0 with a 3.06 ERA in eight starts since his last loss June 20 at Washington.