SAN FRANCISCO -- Matt Cain pitched four effective innings, Buster Posey hit his first home run of the spring and the San Francisco Giants beat the Oakland Athletics 4-0 on Friday night.