PHOENIX (AP) — The Arizona Diamondbacks played small ball looking for the winning run in the ninth inning, and the Los Angeles Angels couldn't defend it.

Angels pitcher Cam Bedrosian threw wildly after fielding a sacrifice bunt attempt in the bottom of the ninth, allowing Jon Jay to score and the Diamondbacks to beat Los Angeles 5-4 on Tuesday night.

Jay was hit by a pitch to start the inning, then moved to second on John Ryan Murphy's sacrifice attempt that turned into a hit. A.J. Pollock then laid down another sacrifice try, and Bedrosian (5-3) attempted to force out Jay at third.

The ball soared past third baseman Taylor Ward, and Jay got up and sprinted home.

"Whatever way. Whatever way you can win the game," Pollock said. "Put some pressure on them and make them make a play. It wasn't the best bunt, but we won the game."

Bedrosian sighed as a he described the moment.

"Just rushed it. I heard 'third, third, third!' and just turned around and spun and just didn't get my body set," Bedrosian said. "Really frustrating."

Diamondbacks closer Brad Boxberger (2-4) pitched a scoreless ninth.

David Peralta drove in three runs and came a triple short of the cycle for Arizona, which has won five of six in taking over first place in the NL West.

"In my opinion, every game is the biggest game of the year from here on out," Jay said. "These are the fun times. These are when you wake up and are excited to go to the ballpark and every game is something big and this is what baseball is all about."

The Angels rallied from a pair of two-run deficits to tie it, scoring twice in the seventh inning on pinch-hitter Jefry Marte's home run and David Fletcher's two-out triple. Fletcher had three hits and two RBIs.

Both teams' starting pitchers lasted six innings but got no-decisions. Felix Pena struck out a career-high 12 but allowed four runs and seven hits for Los Angeles, while Arizona's Patrick Corbin gave up two runs and five hits and struck out eight.

"I felt good. Wish I would have kept it 0-0, but overall I felt fine and everything was working," Pena said in Spanish.

Peralta hit his seventh home run in 12 games, a two-run shot into the Diamondbacks' bullpen in left field with one out in the first inning. The Diamondbacks lead the majors with 109 first-inning runs.

The Angels tied it in the third on run-scoring singles for Fletcher and Andrelton Simmons after Kole Calhoun led off with a double.

But the Diamondbacks got to Pena again in the third, stringing together four consecutive singles for two runs to take a 4-2 lead. Peralta and Steven Souza Jr. had the RBI hits in the inning, though Arizona left the bases loaded.

Marte homered into the second deck in left field with two out in the seventh off reliever Yoshihisa Hirano, making it 4-3. Fletcher tripled off Archie Bradley to drive in Calhoun and tie it.

"We scored four and we hit the ball hard with runners in scoring position," Angels manager Mike Scioscia said. "Those guys made some pitches to get out of trouble."

WILD BAT

Pena swung and missed at a 3-1 pitch in the fourth, and his bat flew into the Diamondbacks dugout and almost struck manager Torey Lovullo.

WEEKEND ROTATION

Lovullo set his starting rotation for the upcoming series against the Seattle Mariners. Right-hander Zack Godley pitches Friday in the opener, followed by left-hander Robbie Ray and righty Zack Greinke. Ray gets an extra day to do some side work with pitching coach Mike Butcher.

TRAINER'S ROOM

Angels: OF Justin Upton went on the 10-day disabled list with a cut on his left index finger he suffered Sunday night. ... OF Mike Trout (wrist) is expected to rejoin the team at the end of the week, Scioscia said. ... P-DH Shohei Ohtani (elbow) pitched a simulated game Monday at the Angels' spring training facility in nearby Tempe. The plan is to get him up to 45 or 50 pitches in a bullpen session early next week and eventually be re-evaluated to return to pitching as a starter. ... RHP Matt Shoemaker will throw a bullpen session on Wednesday, trying to come back from a forearm injury that has forced him out of almost the entire season.

Diamondbacks: RHP Shelby Miller (elbow) threw from 75 feet on Tuesday. ... OF Jarrod Dyson is fielding, hitting and sprinting as he comes back from a groin injury.

UP NEXT

Angels: RHP Odrisamer Despaigne (2-1) is set for his second appearance with the Angels. He hasn't faced Arizona since September 2015 while with the San Diego Padres.

Diamondbacks: RHP Clay Buchholz (6-2) faces the Angels in the series finale on Wednesday. He's made 13 starts against the Angels in his career.