Brandon Belt hit a game-ending single to left-center with one out in the ninth, Buster Posey tied it with a two-run homer in the eighth and the San Francisco Giants rallied to beat the Arizona Diamondbacks 5-4 on Monday night.