PITTSBURGH — Trevor Williams has been pitching in the majors for less than two full seasons. Still, he's come to understand the ups and downs that come with the sport.

"Baseball kicks your (behind)," Williams said. "The highs are so high, and the lows are so low. You have to stay even-keeled."

Williams bounced back from recent struggles by pitching one-hit ball over seven innings and two Pittsburgh Pirates relievers closed out a two-hitter in a 1-0 victory over the Milwaukee Brewers on Monday night.

Williams (6-4) struck out seven and walked two for his first victory in a month and after he had allowed a combined 12 runs in six innings in his previous two starts. Jordy Mercer drove in the lone run with a seventh-inning double, and the Pirates won for the fourth time in five games.

The Brewers entered the day leading the NL Central but suffered their third straight loss.

The only hit off Williams was a single by Jonathan Villar with two outs in the fourth. The hit followed a walk to Hernan Perez, and the duo executed a double steal before Erik Kratz struck out to end the inning.

Pittsburgh manager Clint Hurdle thought fastball command made the difference for Williams.

"Up, down, in, out. It was just an outstanding performance," Hurdle said.

Williams had gone 0-2 in five starts since beating the Chicago White Sox on May 15.

"He hit his spots," Milwaukee right fielder Christian Yelich said. "He was throwing everything for strikes. When a guy is doing that and he's not really missing over the plate much, it's a tough night."

Kyle Crick pitched a perfect eighth inning for Pittsburgh. Yelich singled off closer Felipe Vazquez to open the ninth, ending a string of 13 straight Brewers retired. Vazquez retired the next three hitters for his 14th save in 18 opportunities.

Francisco Cervelli drew a one-out walk in the Pirates' seventh and advanced to third on Josh Bell's single. Josh Hader relieved Jhoulys Chacin and struck out Gregory Polanco, but Mercer followed by doubling down the left-field line to score Cervelli.

"The way both guys were pitching, I think everyone started to think that one or maybe two runs and that was going to be the ballgame," Mercer said.

The run was charged to Chacin (6-2), who had won his previous six decisions and not lost in 13 starts since April 4 against St. Louis. Chacin allowed six hits, struck out two and walked two.

Cervelli had two hits to snap a 0-for-13 skid.

"I feel like I was throwing the ball well," Chacin said. "I was making pitches when I had to. In the last inning, I gave up the hit, but I was more frustrated that I walked Cervelli. That was the guy I couldn't get out."

TRIBUTE TO UECKER

As a surprise tribute to Bob Uecker, the Brewers travelling party dressed in loud sportscoats — popularized by the Hall of Fame broadcaster during his frequent guest appearances on The Tonight Show — for the flight from Milwaukee to Pittsburgh on Sunday night.

Manager Craig Counsell said he had hoped to replicate an outfit Uecker once wore that included a turtleneck sweater with a belt and a pair of bellbottom slacks. Alas, Counsell came up empty in his search for such garb.

PIRATES MOVES

The Pirates activated right-handed reliever Richard Rodriguez from the 10-day disabled list, recalled infielder/outfielder Jose Osuna from Triple-A Indianapolis and optioned right-handed reliever Dovydas Neverauskas and catcher Jacob Stallings to Indianapolis.

TRAINER'S ROOM

Brewers: 3B Travis Shaw (sore right wrist) was given the night off after being injured Sunday during a swing in a loss to Philadelphia.

Pirates: Rodriguez had been out since June 7 with right shoulder inflammation.

UP NEXT

Brewers: RHP Freddy Peralta (1-0, 3.72 ERA) is expected to be recalled from Triple-A Colorado Springs to start Tuesday night. The rookie made two starts with the Brewers earlier this season, including striking out 13 in 5 2/3 innings at Colorado on May 13 in his major league debut, and is 6-1 with a 2.75 ERA in 12 starts with Colorado Springs.

Pirates: RHP Jameson Taillon (4-5, 3.94) is 2-1 with a 2.73 ERA in his last four starts and 1-3 with a 3.47 ERA in seven career starts against Milwaukee.

___

More AP baseball: https://apnews.com/tag/MLBbaseball