Robbie Ray returned from the injured list and pitched five scoreless innings, Eduardo Escobar and Christian Walker each homered, and the Arizona Diamondbacks beat the Milwaukee Brewers 5-2 Sunday to avoid a series sweep.

Ray (11-7) had been out since Aug. 14 due to lower back spasms. He allowed three hits, walked four and struck out six in five innings. The left-hander has thrown 18 2/3 consecutive scoreless innings against the Brewers.

After scoring one run over the first two games of the series, Arizona scored twice in the first inning. Ketel Marte led off with a single, Tim Locastro reached on a fielder's choice and Walker hit a drive to the left field bleachers. It was Walker's 23rd home run of the season and his fourth of the team's eight hits in the series at that point.

Arizona Diamondbacks starter Robbie Ray throws during the first inning of a baseball game against the Milwaukee Brewers Sunday, Aug. 25, 2019, in Milwaukee. (AP PhotoMorry Gash)

Arizona Diamondbacks starter Robbie Ray throws during the first inning of a baseball game against the Milwaukee Brewers Sunday, Aug. 25, 2019, in Milwaukee. (AP PhotoMorry Gash)

Escobar added on in the fourth with his 29th homer. Walker then reached on a double and came around to score on a fielder's choice to make it 4-0.

That spelled the end for Brewers starter Zach Davies (8-7), who has lost five straight starts.

Milwaukee entered the day two games behind the Cubs for the final NL wild card, and Arizona was 5 1/2 back of Chicago.

Arizona Diamondbacks' Christian Walker hits a single during the fifth inning of a baseball game against the Milwaukee Brewers Sunday, Aug. 25, 2019, in Milwaukee. (AP PhotoMorry Gash)

Arizona Diamondbacks' Christian Walker hits a single during the fifth inning of a baseball game against the Milwaukee Brewers Sunday, Aug. 25, 2019, in Milwaukee. (AP PhotoMorry Gash)

Marte scored another run for the Diamondbacks in the fifth on an error by second baseman Keston Hiura. Marte opened the inning with a double off Taylor Williams.

Manny Piña gave Milwaukee its first run in the seventh with his seventh home run. Ryan Braun added another run in the eighth, scoring Hiura on a sacrifice fly. Both runs came off of Yoan López.

Braun, who had a double and a single on the day, has hit safely in each of his last 17 starts.

Arizona Diamondbacks' Christian Walker is congratulated after hitting a two-run home run during the first inning of a baseball game against the Milwaukee Brewers Sunday, Aug. 25, 2019, in Milwaukee. (AP PhotoMorry Gash)

Arizona Diamondbacks' Christian Walker is congratulated after hitting a two-run home run during the first inning of a baseball game against the Milwaukee Brewers Sunday, Aug. 25, 2019, in Milwaukee. (AP PhotoMorry Gash)

Christian Yelich had two hits and his 25th stolen base. The reigning NL MVP stepped to the plate with two on in the bottom of the ninth but grounded out for the final out.

Archie Bradley picked up the save for the Diamondbacks. It was his seventh in 10 chances.

Milwaukee star Yasmani Grandal went hitless on his bobblehead day.

Milwaukee Brewers starting pitcher Zach Davies rests after giving up a two-run home run to Arizona Diamondbacks' Christian Walker during the first inning of a baseball game Sunday, Aug. 25, 2019, in Milwaukee. (AP PhotoMorry Gash)

Milwaukee Brewers starting pitcher Zach Davies rests after giving up a two-run home run to Arizona Diamondbacks' Christian Walker during the first inning of a baseball game Sunday, Aug. 25, 2019, in Milwaukee. (AP PhotoMorry Gash)

TRAINER'S ROOM

Brewers: RHP Jeremy Jeffress was placed on the 10-day IL with a strained left hip. RHP Ray Black was recalled from Triple-A San Antonio. Jeffress said his hip started acting up last week in Washington. He said he's hopeful of a minimum 10-day absence.

UP NEXT

Diamondbacks: LHP Alex Young (5-3, 4.04 ERA) will get the ball Monday in San Francisco. Young is 3-1 with a 3.27 ERA in four road starts this season. He's 1-1 with a 5.40 ERA against the Giants.

Brewers: RHP Gio Gonzalez (2-1, 3.64) will take the mound Monday against RHP Adam Wainwright (9-9, 4.51) and the NL Central-leading Cardinals. Gonzalez allowed one earned run on three hits, walked four and struck out six in five innings in a no-decision against St. Louis on Tuesday.

Follow Keith Jenkins on Twitter: https://twitter.com/MrKeithJenkins

More AP MLB: https://apnews.com/MLB and https://twitter.com/AP_Sports