Updated

SAN FRANCISCO (Reuters) - The San Diego Padres kept their National League West hopes alive by beating the Giants 6-4 in the opener of their do-or-die, three-game series in San Francisco on Friday.

Trailing the Giants by three games with three left to play, the Padres (89-71) pounded San Francisco (91-69) starter Matt Cain for nine hits and six runs in four-plus innings, including homers by Ryan Ludwick, Adrian Gonzalez and Matt Stairs.

Victory by the Padres also improved their chances for the consolation prize of a National League wildcard berth.

San Diego moved within one game of wildcard-leading Atlanta Braves (90-70), who were fell 11-5 to Philadelphia.

Playoff possibilities abound.

Should the Padres sweep the Giants, they would play a one-game playoff against San Francisco in San Diego on Monday for the NL West crown.

If San Diego and the Braves finish tied for the wildcard, they would play a one-game playoff in Atlanta on Monday.

Should all three teams end up 91-71, the Giants would play the Padres in San Diego for the NL West with the loser going to Atlanta on Tuesday to play the Braves for the wildcard.

The Rays (94-66) finish up the regular season with two more games against Kansas City.

Both New York and Tampa Bay are assured of post-season berths, one as division winner and the other as the wildcard.

The AL East champion will get home-field advantage and open at home against AL West winning Texas Rangers. The wildcard team would travel to Minnesota to play the Central champion Twins in their best-of-five first-round series.

(Writing by Larry Fine in New York, Editing by John O'Brien)