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.
"Anytime 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. I tried to be aggressive and keep my composure."
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."
Arizona had lost its previous seven games against St. Louis, dating to last season.
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.
"Just didn't do my job tonight," Motte said. "I felt fine."
St. Louis manager Mike Matheny said Motte ran up against a hot hitter.
"It was a pretty good at-bat Goldschmidt put together," Matheny said. "He fought off good pitches and figured out some timing against him by being able to stay alive. You haven't seen too much of that from Jason. He's been very good this season."
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 of the season.
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 Diamondbacks 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," Arizona manager Kirk Gibson said. "We had good life tonight. Guys were upbeat right until the end and good things happened."
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).