Jake Cronenworth hit a solo home run with one out in the ninth inning and the San Diego Padres beat the Houston Astros 4-3 Sunday to take two of three from the AL West leaders.

Cronenworth, a first-time All-Star this season who has struggled at the plate recently, sent a drive to right-center off reliever Ryne Stanek for his 20th homer of the season. It was the first walk-off home run in his two-year career and his second game-winning hit.

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

One batter earlier, Stanek (1-4) caught Manny Machado's popup behind the mound and then tumbled over backward, popping up with the ball in his glove.

That play brought smiles from Stanek and his teammates. He didn't look that way moments later when Cronenworth connected, immediately punching his glove with his right hand.

The Padres celebrated at the plate with a win that put them back into the lead for the second NL wild-card spot.

San Diego hadn't scored since the first, when it took a 3-1 lead against Luis Garcia, one of the top rookies in the AL.

The Astros tied it in the seventh when Yuli Gurriel and Carlos Correa homered on consecutive pitches off Chris Paddack. Gurriel homered to left on a 2-0 pitch, his 14th and Correa hit Paddack's next delivery over the fence in center, his 22nd.

Padres closer Mark Melancon (4-2) came into a 3-3 game in the ninth and issued consecutive walks to Kyle Tucker and Gurriel before getting Correa to hit into a double play. After walking Jake Meyers, Melancon struck out pinch-hitter Aledmys Diaz.

Paddack allowed three runs and six hits in six-plus innings, and had no strikeouts or walks.

Paddack dodged some potential big trouble in the first. Jose Altuve hit a leadoff double and Michael Brantley reached on a throwing error by Cronenworth at shortstop. Right fielder Fernando Tatis Jr. tried to make a siding catch on Alex Bregman's flyball but it fell in for a single that brought in Altuve.

Tucker, who homered in each of the first two games of the series, flied out and Paddack got Gurriel to hit into a double play.

The Padres then jumped on Garcia for three runs in the first inning. Three of the first four batters reached to load the bases before Wil Myers hit a sacrifice fly and Eric Hosmer followed with a two-run double to left.

Garcia allowed three runs and six hits in six-plus innings, struck out five and walked one.

CLICK HERE TO GET THE FOX NEWS APP

VERSATILE MACHADO

Machado, a third baseman, had a putout in deep right field and an assist from his normal position in the fourth inning. Machado, who often plays in shallow right when the Padres shift against left-handed batters, tracked down Tucker's fly ball in deep right for the first out of the inning and then, back at the hot corner, gloved Carlos Correa's grounder and threw to first for the third out.

TRAINER'S ROOM

A day after fouling a ball off his left knee, Yordan Alvarez wasn't in the Astros lineup but he did pinch-hit, striking out in the seventh. He was in so much pain Saturday night that he had to be helped off the field. The team said X-rays were negative and Alvarez has a bruised knee.

UP NEXT

Astros: RHP Lance McCullers Jr. (10-4, 3.20) is scheduled to start Monday night in the opener of a three-game home series against Seattle. The Mariners will counter with LHP Yusei Kikuchi (7-7, 4.12.

Padres: Haven't named a starter for Tuesday night's opener of a two-game home series against the Angels.