Updated

Cardinals closer Jason Motte had gone more than two years without giving up two home runs in the same game.

That string came to an end Thursday night when Motte surrendered homers to Paul Goldschmidt and Chris Young on consecutive pitches with one out in the ninth inning, giving the Arizona Diamondbacks a 2-1 win over St. Louis.

"It wasn't good," Motte said. "I didn't do my job tonight. It was one of those things."

Motte had not allowed two homers in a game since a 6-3 loss to Houston on May 10, 2010. He had converted four straight save chances coming in.

"He's been great all season," St. Louis manager Mike Matheny said. "You haven't seen too much of that from Jason."

Even Young was surprised. It was only the fourth time Motte allowed two homers.

"He's a great pitcher. I just wanted to be aggressive against him," Young said.

With St. Louis ahead 1-0 on Allen Craig's RBI single in the fifth, Motte (4-4) struck out Miguel Montero leading off the ninth. Goldschmidt, who hit a 456-foot homer in Wednesday's 5-2 loss, fouled off three full-count pitches, then drove the ninth pitch of the at-bat to center for his 18th home run this season.

"Any time you've got two strikes, you have to battle, especially against one of the best closers in the league," Goldschmidt said. "They're going to get you more than you get them. Luckily, it worked out."

Young sent the next pitch over the left-field wall for his 12th homer.

"I was just trying to make it happen," Young said. "Motte is a power pitcher, and you know he's going to be around the plate."

Young said he simply parlayed the momentum from Goldschmidt's homer into the go-ahead drive.

"Goldie came through huge for us and kind of took the pressure off me," Young said. "At that point, for me, it was just go out and try to win the ballgame."

David Hernandez (2-2) pitched a perfect eighth, and J.J. Putz finished with a 1-2-3 ninth for his 14th consecutive save and 23rd in 27 chances overall.

Arizona had lost its previous seven games against St. Louis dating to last year.

Motte blew a save for the fifth time in 32 chances. He gave up a two-out double to Jake Elmore before being removed for only the fourth time this season.

"You usually don't do that against a pitcher like him," Arizona manager Kirk Gibson said.

In a game that started 1 hour, 25 minutes late because of rain, Arizona's Trevor Cahill allowed one run and five hits in six innings with four strikeouts and one walk. The Cardinals' Kyle Lohse gave up four hits and three walks in 6 2-3 innings, striking out five. He lowered his ERA to 2.61, third-best in the NL.

St. Louis went ahead in the fifth after Rafael Furcal led off with an infield single, Lohse grounded into a forceout and Cahill hit Jon Jay with a two-strike pitch. Craig followed with his 62nd RBI.

Arizona threatened in the fourth. Aaron Hill walked but was thrown out by catcher Tony Cruz trying to steal second, completing a double play as Justin Upton struck out. Montero singled and Goldschmidt walked, but Lohse struck out Young.

Arizona hit consecutive homers for the third time this season. The Diamondback had scored just four runs over the first 26 innings of the series.

"It's been a slow go for us and we were getting shut out again," Gibson said. "We had good life tonight. Guys were upbeat right until the end and good things happened."

NOTES: St. Louis C Yadier Molina missed his second straight game because of lower back tightness. He is day to day. ... Arizona SS Jake Elmore got his first major league hit with a single in the seventh inning and finished 2 for 4. He was doused by teammates in the locker room after the game... The Diamondbacks have played 10 successive games against teams with winning records and are 4-6. ... St. Louis hosts Pittsburgh on Friday in the opener of a three-game series. Jake Westbrook (12-8) will face James McDonald (10-5). Arizona travels to Houston for a three-game series that will conclude a six-game trip. Wade Miley (12-8) takes on Dallas Keuchel (1-4).