SAN FRANCISCO (AP) — Buster Posey had three hits and four RBIs, Hunter Pence added three doubles and scored three times, and the San Francisco Giants broke out of their offensive slump with a 13-8 victory over the Minnesota Twins on Sunday that avoided a three-game sweep.

Eduardo Nunez also had three hits and scored three times while rookie Austin Slater had three hits and a career-high four RBIs to help the Giants win for the fourth time in 12 games.

San Francisco had been held to two runs over the first two games of the series before setting season highs for hits (17) and scoring. The Giants also had a San Francisco record-tying eight doubles.