Updated

Ryan Vogelsong pitched into the seventh inning, Buster Posey homered among his four hits and the San Francisco Giants broke out of an offensive slump to beat the Colorado Rockies 16-4 on Friday.

Brett Pill also went deep and Angel Pagan had three hits and scored four runs for the Giants, who had lost seven of their past eight.

Wilin Rosario homered for the Rockies, who have lost 9 of 11.

The Giants were shut out twice and held to one run in two other games during their recent slump but broke out against Colorado. They had a season high in runs and matched their season best with 16 hits.

San Francisco wasted no time in getting on the board against Jonathan Sanchez (0-3). The first four batters reached as the Giants took a 2-0 lead on their former teammate.

Sanchez, who tossed a no-hitter for the Giants on July 10, 2009, lasted only three innings, walking three and throwing two wild pitches.

Sanchez has struggled in three starts since coming to Colorado for Jeremy Guthrie on July 20. Friday's start was his shortest outing of his three games.

Pill made it 3-0 when he hit a leadoff homer in the fourth off Adam Ottavino.

The Giants blew it open against Mike Ekstrom in the seventh. Vogelsong led off with a double and scored on Pagan's double. Ryan Theriot walked and Melky Cabrera doubled down the left-field line to make it 6-0.

Cabrera scored on Marco Scutaro's groundout to make it 7-0.

Vogelsong (9-5) cruised early. He retired the first nine batters of the game and allowed just one hit through six innings.

The Rockies broke through in the seventh. Dexter Fowler led off with a triple and scored on a sacrifice fly. Jordan Pacheco and Todd Helton hit consecutive doubles, and one out later Rosario hit his 18th homer down the left-field line to make it 7-4.

George Kontos relived Vogelsong and got the last two outs to end the inning.

Vogelsong allowed four runs and five hits, struck out seven and walked two in 6 1-3 innings.

The Giants scored six times in the eighth — three on Posey's 15th homer and two on wild pitches by Matt Reynolds. They added three more in the ninth.

Notes: Fowler's triple was the 50th of his career, the most in club history. ... Hunter Pence's single in the eighth was his first hit as a Giant. He was 0 for 10 since being traded to San Francisco on Tuesday. ... Rockies RF Michael Cuddyer (sore right oblique) was out of the starting lineup for the third straight game. He could start Saturday. ... The Giants will send Madison Bumgarner (11-6) against Colorado's Jeff Francis (3-3) on Saturday.