CINCINNATI — Billy Hamilton stepped into the batter’s box and was determined to get home, one way or another. Quickly, the speedster wound up scoring the winning run.

Hamilton hit the first walkoff homer of his career, connecting for a solo shot with two outs in the bottom of the ninth inning that sent the Cincinnati Reds over the Milwaukee Brewers 5-4 Monday.

“I was going to hit a home run if it landed in play any way,” Hamilton said. “Hitting off the wall and beating it home was the goal there.”

Hamilton, who leads the majors with 58 stolen bases, hit a drive into the left-field seats for his fourth homer of the season. He connected off Josh Hader (1-3).

“He had his good stuff,” manager Craig Counsell said. “We wanted him in there with his good stuff. Those were the three hitters we wanted him to get. He put a fastball in the middle of the plate, and he put a good swing on it.”

Counsell was surprised that Hamilton won it with a homer.

“Yeah, he’s not known for that,” Counsell said. “It happens. Anybody’s capable of doing it, especially in this ballpark.”

The last-place Reds opened a three-game series by stopping the playoff-contending Brewers. Raisel Iglesias (3-2) pitched a perfect ninth for the win.

Hamilton had two hits and also threw a runner out at the plate from center field for his 12th assist.

“Saving a run was better for me,” Hamilton said, who is one assist behind major league-leading teammate Adam Duvall. “Me and Duvall go out there every day to try to outdo each other. He still has one up on me. I’d rather throw a guy out than hit the big homer. but I’ll take both of them.”

The Reds overcame Orlando Arcia’s tying, three-run homer in the seventh. His 14th homer of the season, off reliever Michael Lorenzen, wasted an impressive outing by Homer Bailey, who pitched six impressive innings before wilting in the seventh.

Bailey, who’s had three surgical procedures on his arm since September 2014, retired 14 straight batters and 15 of 16 through the sixth before Ryan Braun led off the seventh with his 14th homer of the season and 25th of his career at Great American Ball Park, more than any other player.

The Brewers reached Bailey, who also scored a run on a bases-loaded walk in the third, for six hits and three runs. He didn’t walk anybody and struck out four.

“This was like Homer of 2012 and 2013,” manager Bryan Price said. “He had both good stuff and command.”

Eugenio Suarez also drew a bases-loaded walk from Milwaukee starter Chase Anderson in the sixth before Tucker Barnhart, in his first game since becoming a father for the first time, delivered a two-run double.

Bailey capped a nine-pitch at-bat with a line drive single in the third. He was safe at second when Arcia bobbled Hamilton’s grounder for his 17th error of the season in 131 games. Arcia went into the game second among National League shortstops in errors.

Anderson, in his fourth start since returning from a left oblique strain, allowed seven hits and three earned runs in 5 1/3 innings.

“I felt good overall. My command was a little off. The offense picked me up today. Overall, I felt pretty good. I feel like I’m getting back to where I was,” he said.

MATT’S THE MAN

RHP Matt Garza will start for Milwaukee against Cincinnati on Wednesday, Counsell said. Garza (6-8) was roughed up for four hits and three walks while giving up six runs — three earned — in 3 1/3 innings of a 10-2 loss to St. Louis on Aug. 29.

LONG DAY

Reds RF Scott Schebler was hitting .360 over his last nine games before Monday, but he went 0 for 4 with three strikeouts. He also missed two attempts at diving catches. Neither try led to Milwaukee runs.

NEED ONE

The Brewers remain one win short of 73, which would match their total from last season.

TRAINER’S ROOM

Brewers: 2B Neil Walker was late going to his position for the bottom of the first after being thrown out at the plate by Hamilton trying to score on Travis Shaw’s fly ball. A trainer was holding a towel to Walker’s face as the two walked off the field after the play.

Reds: OF Jesse Winker is at least a “couple days” away from being activated, Price said. Winker has been on the 10-day disabled list since Aug. 25 with a left hip flexor injury.

UP NEXT

Brewers: Team wins leader Zach Davies (16-7) is the scheduled starter in Tuesday’s middle game of the three-game series. Davies is 1-0 in two starts against Cincinnati this season.

Reds: After going 3-0 in August, rookie RHP Robert Stephenson (3-4) makes his fourth appearance of the season and first start against Milwaukee on Tuesday.