PHOENIX -- After resting most of their regular hitters, the Arizona Diamondbacks came through with a big win to avoid falling further behind in their playoff chase.
"We were not throwing in the towel today, and I think everybody in that dugout knew it," Diamondbacks manager Torey Lovullo said, promising that his "main guys" will be back in the lineup for the next game.
Walker and Owings, mainly used off the Arizona bench, were part of a Diamondbacks lineup that featured only two regulars in the field -- Nick Ahmed and Ketel Marte. The group did most of its damage against Hamels (9-10), who had yet to lose a start since joining the Cubs via trade from Texas on July 27.
"What can you say? You get the understudies into a ballgame, they bring a certain energy to the start of a game and we end up playing downhill baseball with that big three-run home run by Walker," Lovullo said. "I felt like the time was right (to rest regulars) and it worked out well."
Arizona avoided a series sweep, put an end to a four-game losing streak and gained a game on St. Louis for the second wild card, although they still trail the Cardinals by five games. The Diamondbacks remained six games out behind the first-place Los Angeles Dodgers in the NL West.
Ray (6-2) struck out eight and walked four. Walker and Owings drove in three runs each.
"My fastball away was really effective," Ray said. "Honestly I didn't look at our lineup before I went out there."
The Cubs' lead in the NL Central dropped to 2 1/2 games over Milwaukee, which beat Cincinnati earlier Wednesday.
The Diamondbacks tagged Hamels for four runs and five hits in the first inning. Walker's homer, his third of the season, sailed onto the overhang in left-center field with Ildemaro Vargas and Marte on base.
Later in the inning, Owings blooped a single to shallow right field, and Patrick Kivlehan scored after he'd tripled to make it 4-0.
Kivlehan became the second Diamondback this season to triple multiple times in a game when he did it again in the sixth inning. He scored on Ahmed's single, and Ahmed scored on Owings' fourth home run of the year.
"Basically going out there with nothing to lose," Owings said.
"We knew we had to go out there and do a good job," Kivlehan said. "We just tried to keep it simple and not put too much pressure on ourselves."
Mathis went deep to left in the eighth for his first home run of the season.
Hamels allowed seven runs and nine hits, tying the most earned runs he's given up in a start this season.
"They got key hits all at the right time," Hamels said. "Three-run home runs, two-run home runs, they definitely hurt and makes it tough to come back."
The Cubs completed a stretch of 30 scheduled games in 30 days with 18 wins.
"Sign me up," Cubs manager Joe Maddon said. "We will take that every day of the week. I'm proud of my guys. We won five of our last seven through all this in different cities."
Both teams added pitchers to their respective rosters before the game. The Cubs brought up Webster, with injured reliever Brandon Morrow transferred to the 60-day disabled list.
The Diamondbacks called up right-hander Jake Barrett from Triple-A Reno. He's been back and forth between Arizona and Reno three previous times this season.
Cubs: After a long-awaited day off Thursday, the Cubs are back in Chicago to open a three-game series against their crosstown rival White Sox. LHP Jose Quintana (13-10) is the scheduled starter in Friday's opener, and makes his first career start against his former team.
More AP baseball: https://apnews.com/tag/MLBbaseball
Mariano Rivera, Roy Halladay on Hall of Fame ballot
Career saves leader Mariano Rivera and late pitcher Roy Halladay are among 20 new candidates on the Hall of Fame ballot for the Baseball Writers' Association of America, joined by 15 holdovers headed by Edgar Martinez.
Indians unveil alternate red home jerseys for 2019 season
The team unveiled a new alternate home jersey on Monday. It's a red top scripted with "Indians" on the front that Cleveland occasionally will wear for home games in 2019.
Reports: Nats agree to deal with catcher Kurt Suzuki
Catcher Kurt Suzuki is leaving the Braves to join their NL East rival, agreeing to a two-year contract, according to multiple reports.
Bryce, Manny, Corbin and more? What a Yankees spending spree could bring
The Bronx hasn't been home to a World Series champion for almost an entire decade. We offer up five offseason moves that would fix that -- if the Steinbrenners are willing to spend like The Boss.
Which teams should shift gears and become buyers or sellers?
The Diamondbacks have been contenders, but they're among the clubs who might want to shake things up by shopping stars like Paul Goldschmidt.
How the Phillies can be smart spending stupid amounts of money
The Phillies have plenty of payroll space and expectations of contention to deliver on. Here's a plan for which top free agents they should target.