Astros top Pirates, 5-4

Houston Astros' Marwin Gonzalez slides safely into third with a triple as Pittsburgh Pirates' Sean Rodriguez applies a late tag in the fourth inning of a baseball game in Pittsburgh, Wednesday, Aug. 24, 2016. (AP)

PITTSBURGH (AP) – A solid road trip kept the Houston Astros on the right path toward a playoff spot.

Evan Gattis hit his 20th home run and Carlos Correa got two hits and scored twice, leading Collin McHugh and the Astros over the Pittsburgh Pirates 5-4.

The Astros won the interleague matchup between wild-card contenders. They went 5-2 on a trip that began in Baltimore.

“I’m really proud of our guys. We have a small margin of error these days and we’ve responded by playing well,” manager A.J. Hinch said.

McHugh (8-10) gave up three runs in five innings, ending an 0-4 rut in his last five starts. Ken Giles closed for his fifth save.

Gerrit Cole (7-9) allowed five runs in five innings. He has a 6.07 ERA through five August starts.

Pittsburgh has lost five of six.

“I’ve been trying to look at approaches and maybe see how I can use my stuff better. I thought today there were some good steps in the right direction: some good sliders, some good curveballs for strikes,” he said.

“Miss over the plate, and I’m getting punished. That’s the bottom line,” he said.

Gattis homered in the second, connecting after a single by Correa.

“We did a pretty good job of executing some at-bats,” Hinch said. “(Cole) has some really good stuff and we stayed enough inside the strike zone. Gattis delivers the big blow. I think that relaxed the dugout a little bit.”

Correa reached on an infield single in the fourth and scored on a triple by Marwin Gonzalez.

George Springer singled to begin the fifth and Alex Bregman followed with a double, setting up sacrifice flies by Jose Altuve and Correa for a 5-1 lead.

Jordy Mercer homered in the Pittsburgh third.

The Pirates closed to 5-3 in the fifth on RBI singles by Starling Marte and Gregory Polanco.

Polanco, who hit two home runs Tuesday, tripled home Marte in the seventh.