Everything looked great for the Arizona Diamondbacks.
They led San Francisco 7-3 after seven innings in front of a capacity Chase Field crowd.
Then the bullpen fell apart and the Giants rallied for a 9-8 win on Buster Posey's two-run home run in the ninth inning off new Arizona closer Addison Reed.
"Terrible pitch, good swing," Reed said. "It was right over the middle of the plate. Anybody is going to hit that a long way.
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.
"It stings a bit but we need to regroup and come back tomorrow," Arizona manager Kirk Gibson said.
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
In the Giants big seventh, pinch-hitter Ehire Adrianza doubled in a run, ending Arizona starter Brandon McCarthy's night.
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."
Gibson called "a tough call."
"I know Mac wanted the call on Adrianza. We didn't get that call but you got to get those outs," Gibson said. "You expect to close that game down but we didn't do it. We gave into it. `'
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 groundball. 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.
NOTES: 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.