The San Francisco Giants have defeated the Kansas City Royals 3-2 in the deciding seventh game to win the Major League Baseball World Series.

Giants ace pitcher Madison Bumgarner threw five scoreless innings in relief Wednesday night to close out the game and cement Most Valuable Player honors for the series. The championship is the third for the Giants in the past five years.

Bumgarner was dominant in his three appearances in the series, starting two earlier games and allowing a total of just one run on nine hits while striking out 17 Kansas City hitters.

Photo Gallery:

San Francisco Giants Win Baseball World Series

Manager Bruce Bochy called Bumgarner's performance "truly amazing," as the pitcher set a new record for most innings pitched in a postseason.

The Royals nearly completed another dramatic comeback Wednesday in a playoff run that included four extra-inning wins.

With Bumgarner pitching with two outs in the bottom of the ninth -- at a time his manager later said he was "exhausted" -- Royals outfielder Alex Gordon smacked a ball toward Giants center fielder Gregor Blanco, who misplayed it, allowing the ball to roll all the way to the wall and Gordon to reach third base.

But Bumgarner quieted the raucous crowd in Kansas City, getting Royals catcher Salvador Perez to pop up a fastball to third baseman Pablo Sandoval, who squeezed it and set off celebrations by San Francisco players on the field and their fans back home.

The series was an unlikely matchup, featuring the two so-called Wild Card teams. Each had to win a special one-game playoff to even make the main draw in the postseason against the league's division champions.