SAN FRANCISCO — Alex Reyes pitched seven dominant innings in his third major-league start, fellow rookie Aledmys Diaz hit a two-run homer and the Cardinals moved up in the tight NL wild-card race, blanking the Giants 3-0 on Sunday.

The Giants dropped one game behind the Mets for the top wild-card spot. The Cardinals closed within one game of the Giants.

The Cards split this four-game series, winning the final two. The Giants finished a 2-5 homestand and have won just one series at AT&T Park since the All-Star break.

Reyes (3-1), considered one of the majors' best pitching prospects, hasn't disappointed since he was called up from the minors Aug. 9 when Michael Wacha went on the disabled list with shoulder discomfort.

Reyes gave up four hits, striking out six with two walks. The 22-year-old righty's fastball was consistently in the middle to upper 90s.

Seung Hwan Oh pitched a scoreless ninth for his 18th save.

Diaz hit his 16th homer, a two-run drive in the third off Albert Suarez (3-4). The All-Star's 16th home run followed Matt Carpenter's two-out double.

Suarez has allowed three runs or fewer in his first 11 career starts, but the rookie is winless in 10 outings, including six starts, since June 23.

Plate umpire Brian O'Nora left the game after being struck in the mask by a foul ball off Hunter Pence's bat in the second inning. First base umpire Laz Diaz called the rest of the game behind the plate.

The Cardinals are off to Colorado, while the Giants will open a series against the Dodgers in Los Angeles.