(Reuters) - The San Francisco Giants left the Washington Nationals frustrated, exhausted and on the brink of elimination after they claimed an 18-inning marathon with a 2-1 win in the longest game in Major League playoff history.

Brandon Belt blasted a solo home run in the 18th to snap a long 1-1 tie and the Giants seized a 2-0 lead in the best-of-five National League Division Series. The wild contest lasted six hours and 23 minutes, surpassing the previous longest post-season game of five hours and 50 minutes played by Atlanta and Houston in 2005. In Saturday's thriller, a total of 39 players and 16 pitchers were used on both sides.

"The way this game was going it could have went another five innings," Belt told reporters. "We're just happy to get out of here. It was nice to see that ball go over the fence."

The Nationals were one out away from a victory in the ninth inning before San Francisco rallied with an RBI double from Pablo Sandoval, leading to their 10th straight playoff win

Washington manager Matt Williams and catcher Asdrubal Cabrera were both ejected in the 10th inning for arguing balls and strikes.

The critical ninth featured a questionable decision by Williams, who removed starting pitcher Jordan Zimmermann after the right-hander issued a two-out walk with no one on base. Reliever Drew Storen came on and gave up a pair of hits, including the tying one.

"I never disagree with (Matt Williams). He's the manager, he makes the decisions," Zimmermann said. "I'd like to stay out there but Drew has been lights out all year. It just didn't work out that time." San Francisco's Buster Posey tried to score the go-ahead run from first base on the Sandoval hit but was thrown out at home plate on a marginal play that was reviewed and upheld by the umpires. Each team got strong starting pitching efforts as San Francisco's Tim Hudson went 7 1/3 innings and struck out eight.

Zimmermann lasted the 8 2/3 innings in his first start since tossing a no-hitter against Miami in the regular season finale on Sept. 28. The Giants can complete the sweep and advance to their third National League Championship Series in five years with a Game Three win in San Francisco on Monday.

(Writing by Jahmal Corner; Editing by John O'Brien)