PHOENIX — Brandon Drury came out of high school thinking he might help the Atlanta Braves win games one day. He did just the opposite Wednesday night.

Drury drove in Jake Lamb with a sacrifice fly in the 11th inning, giving the Arizona Diamondbacks a 10-9 win over the Braves.

The Diamondbacks loaded the bases with a double, a hit batter and an intentional walk against reliever Jose Ramirez (2-1). Matt Kemp dived to catch Drury’s sinking liner to left but couldn’t get off a good throw to stop Lamb.

Drury was a 13th round pick by the Braves in 2010 and traded to Arizona in 2013 in a package for Justin Upton.

“I was just looking for a fastball. They said his slider was pretty small, and I just trusted that I would pick it up. I didn’t hit it that hard, but I go the job done and helped the team win,” Drury said.

The Braves rallied from a 9-4 deficit in the eighth to tie it 9-9 with four runs in the ninth. Adonis Garcia led off the ninth with a home run and the next five Braves reached base.

Atlanta stranded runners on second and third, though, and the game went to extras. They also loaded the bases in the 10th.

Former starter Patrick Corbin (5-13) pitched two scoreless innings in relief to earn the win.

Diamondbacks ace Zack Greinke struck out five and reached 2,000 for his career. Greinke pitched six innings and allowed four runs, six hits and three walks in his first home start since June 28. He left that outing with a strained left oblique and went on the disabled list for more than a month.

Greinke, 32, became the 78th pitcher to reach 2,000 strikeouts, fanning Freddie Freeman to start the fourth for the milestone.

“I don’t really think about it at the moment. It is a pretty big number,” Greinke said. “It was a good pitch. I stopped making good pitches after that one pretty much.”

For the Diamondbacks, Welington Castillo drove in three runs with a double and a two-run single. Paul Goldschmidt and Lamb hit two-run home runs and Jean Segura’s solo home run in the fifth was his 12th of the season, tying his season high from 2013.

Goldschmidt became the third first baseman since 1974 to record 20 doubles, 20 homers and 20 stolen bases in consecutive seasons, along with Jeff Bagwell in 1996-97 and Ryan Klesko in 2000-01.

Segura’s homer landed just to the left of the 413-foot sign in left-center field. Lamb’s was his 25th of the season. Michael Bourn tripled twice as part of a four-hit night and gave Arizona 50 triples this season, a franchise record.

Bourn and Goldschmidt combined to score six of the Diamondbacks’ runs. The two teams combined for 32 hits.

Ender Inciarte had four hits for the Braves and Nick Markakis and Tyler Flowers each had three. Julio Teheran (3-10) pitched six innings, allowing six runs and 11 hits with four strikeouts. Atlanta has lost nine of 11 games.

“We had a legit chance to win against one of the better pitchers in baseball, and it’s a tough one to lose,” Braves interim manager Brian Snitker said. “It was right there in front of us, it felt like, coming back like we did in the ninth. But we weren’t able to pull it off.”

BRAVES DEAL FRANCOEUR

Atlanta completed a three-team trade involving the Texas Rangers and Miami Marlins, with the Braves sending veteran outfielder Jeff Francoeur to the Marlins.

Francoeur was the only major leaguer involved and was dealt along with cash considerations. Atlanta acquired minor league shortstop Dylan Moore from Texas and minor league catcher Matt Foley from Miami.

Francoeur hit .249 with seven home runs and 33 RBIs in 99 games for the Braves. The 32-year-old plays left field and right field and is known for a strong arm. He was seen in the Braves dugout saying goodbye to coaches and teammates early in Wednesday’s game.

Snitker said infielder Brandon Snyder will be called up from Triple-A Gwinnett to be added to the roster in place of Francoeur.

UMP STRUCK

Second base umpire Alfonso Marquez was hit on the right hip by Freeman’s line drive in the seventh. He stayed in the game after walking it off.

TRAINER’S ROOM

Braves: Atlanta was expected to place pitcher Rob Whalen on the disabled list with right shoulder fatigue, but he was active Wednesday and grounded into a fielder’s choice to end the top of the 10th as a pinch-hitter. He was put on the DL after the game.

Diamondbacks: OF Yasmany Tomas was held out due to back stiffness, a night after being taken out of the game in the eighth inning with the injury. He was on deck during Drury’s sac fly. … OF A.J. Pollock’s season debut with Arizona is set for Friday. He’s back from a fractured right elbow and played in his 11th rehab game Tuesday night.

UP NEXT

Braves: RHP Matt Wisler was recalled from Triple-A Gwinnett to start Thursday’s game against Arizona. Wisler is 4-11 in 20 starts for Atlanta this season.

Diamondbacks: LHP Robbie Ray is coming off a week in which he went 2-0 and struck out 18 to earn the NL Player of the Week honor, and brings a 7-11 overall mark to his start against Atlanta on Thursday.