PHOENIX -- When he struck out to end the first inning, Paul Goldschmidt flipped his bat and his helmet. Tame gestures for most players, but a rare show of emotion by the D-backs' first baseman.
As he grabbed his glove and headed out to first, Goldschmidt reminded himself that there were eight innings left to play and he could still find a way to help his team win.
Goldschmidt certainly did that as he homered to tie the game in the ninth and then won it with a home run to lead off the 11th inning as the D-backs beat the Orioles, 4-3, on Tuesday night at Chase Field.
It was Goldschmidt's fourth walk-off hit of the season and his third walk-off homer of the year.
"He rises to the occasion," D-backs reliever Heath Bell said. "When we need a big hit, he comes through for us."
For the D-backs it was their third walk-off win on this homestand and the second in as many nights.
The D-backs seemed on their way to defeat before Goldschmidt led off the ninth with a home run just over the wall in left off Baltimore closer Jim Johnson to tie the game at 3.
"I was able to get ahead 2-0 and then 3-1 and just looking to get a good pitch so I can hit it hard," Goldschmidt said. "And fortunately I was able to get it out of there just barely, but it still counts."
One out later, Martin Prado grounded a single to left and Gerardo Parra followed with a double off the wall in center to put runners at second and third, but Johnson settled down to strike out Wil Nieves and induce Didi Gregorius to ground out to end the inning.
The teams stayed tied until Goldschmidt led off the 11th against T.J. McFarland and hammered the first pitch into the seats in right for his 29th home run of the year.
"I threw a bad pitch, left it middle and he was able to get a lot of the barrel on it and hit it out," McFarland said. "He's a good hitter, first pitch swinging at the fastball he was able to put it out in right field."
First, though, he had to let go of his first inning at-bat, which resulted in a strikeout when he swung at a pitch well out of the strike zone and led to his uncharacteristic reaction.
"I never want to do that," Goldschmidt said of throwing his bat and helmet. "You don't want to set a bad example for a lot of kids that might be watching, but sometimes your emotions get the best of you."
When he does fail, Goldschmidt goes through a set of mental keys to try to get himself back on track.
"You tell yourself that it's a game of failure," Goldschmidt said. "Or remind yourself that you can still find a way to impact the game and help your team win. Whatever it takes to remind yourself the past is the past. Dwelling on the negative isn't going to help you forward."
It was relatively easy for Goldschmidt to move on Tuesday, because while he was upset at swinging at a bad pitch, he thought he had good mechanics at the plate and his timing was good.
That would prove to be true as he singled in the fourth, the first hit the D-backs managed against Orioles starter Miguel Gonzalez.
While Goldschmidt and his teammates were struggling to solve Gonzalez early, the home run ball hurt D-backs starter Randall Delgado.
The Orioles took a 2-0 lead in the fourth when Nick Markakis drew a walk and one out later Chris Davis blasted a home run to right, his Major League-leading 44th on the year and second in as many days.
An inning later, Delgado missed his spot with a fastball and J.J. Hardy hit it into the seats in left for a 3-0 Baltimore lead.
The D-backs finally broke through against Gonzalez in the seventh.
Aaron Hill started the rally with a one-out triple and he scored when Prado followed with a groundout.
Parra then hit a towering home run to right as the D-backs pulled to within 3-2.
The victory helped the D-backs keep pace with the first-place Dodgers in the National League West standings. Arizona remains 7 1/2 games behind.
"We've been kind of inconsistent this last month, so while it's good to get a few wins, we need to try and do it on a more consistent basis," Goldschmidt said. "We need to just focus on what we can do and just keep playing hard, and whatever happens ahead of us, or behind us, is kind of out of our control."
Steve Gilbert is a reporter for MLB.com. Read his blog, Inside the D-backs, and follow him on Twitter @SteveGilbertMLB. This story was not subject to the approval of Major League Baseball or its clubs.