Heliot Ramos had three hits, including a two-run shot in the sixth, and Matt Chapman broke the deadlock with an RBI single in the top of the 12th, giving the San Francisco Giants a 7-6 win over the Washington Nationals in extra innings.