PHOENIX -- The San Francisco Giants were kicking the ball around so badly Monday night that manager Bruce Bochy wanted to start spring training over again.
Then the Giants' bats came alive, Arizona's bullpen wilted, and San Francisco rallied from four runs down to beat the Diamondbacks 9-8 on Buster Posey's two-run home run off new closer Addison Reed in the ninth inning.
"I think we want to be a team that keeps grinding and keeps pushing," Posey said. "It was nice to be able to do that tonight right out of the chute to give us that confidence that when we get down we know we have the ability to come back."
Posey's star turn didn't surprise Giants starter Madison Bumgarner, who left after giving up four unearned runs in four innings.
"He's on a different level, man," Bumgarner said. "He's so good and he's been that good since day one. It's fun to watch him play every day."
Posey had no experience against Reed, who came to the Diamondbacks in an offseason trade from the Chicago White Sox.
"I've never faced him before, spring training or anything," Posey said. "I was really just trying to get a pitch I can handle."
He got it on a fastball that he sent over the left field wall.
"For us to come back and win a game like that, it just shows you, you go hard for nine innings ," Bochy said. "These guys did and got some big hits later in the game. It seemed like it got contagious, then Buster came through for us in a big way.
It was the season opener for San Francisco and the first true home game for the Diamondbacks, who started the season with two losses as the home team against the Los Angeles Dodgers in Australia.
Miguel Montero, who had three hits and reached base five times, homered to lead off the Arizona ninth and make it a one-run game.
Brandon Belt had three hits, including a solo home run, and singled ahead of Posey's homer.
Arizona scored four unearned runs off Bumgarner in the fourth and led 7-3 after six. San Francisco got four runs with two outs in the seventh, with reliever Brad Ziegler walking in the tying run.
Jean Machi (1-0) pitched 1 2/3 innings of relief to get the victory. Reed (0-1), acquired from the Chicago White Sox in the offseason, got the loss. Sergio Romo, who gave up the home run to Montero, earned the save.
After Montero's shot to left, Chris Owings reached on a bunt single and was sacrificed to second by Gerardo Parra. Pinch-hitter Eric Chavez struck out and A.J. Pollock, who has started the season 0-for-13, popped out to end it. Pollock was 0-for-6 with four strikeouts.
McCarthy was livid about home plate umpire Tom Hallion's call of a ball on a 2-2 pitch just before the double.
"There was a call in the seventh that changed the entire outlook of the game," McCarthy said. "We all have to execute after that point but ... it kind of leaves a bitter taste."
Oliver Perez came in and gave up three hits without an out, including an RBI double by Angel Pagan's RBI double and Pablo Sandoval's run-scoring single. Ziegler relieved Perez and gave up a single to Posey to load the bases, then walked Hunter Pence for the tying run.
Arizona's four-run fourth inning opened with a fielding error by second baseman Joaquin Arias on Mark Trumbo's ground ball. Montero hit a bouncer to the third baseman Sandoval, who bobbled it just long enough for Trumbo to make it to second.
The Diamondbacks greeted reliever Yusmeiro Petit with four consecutive hits in the fifth, including a leadoff double by Martin Prado, followed by Trumbo's RBI single. Parra got his third RBI of the night with a ground out and Arizona led 6-2.
The Diamondbacks got their seventh run after the Giants botched a rundown play between first and second.
Arizona's Goldschmidt extended his hitting streak to 22 games, dating to last season. ... McCarthy struck out the side in the first. He did that once last season, April 16 against the Yankees. ... The Giants opened on the road for the fifth straight year. ... On Tuesday night, Wade Miley (0-1) pitches for Arizona, Matt Cain goes for the San Francisco.