HOENIX (AP) — Ketel Marte capped a three-hit afternoon with a walk-off single in the ninth inning, rookie Brandon Pfaadt pitched 5 2/3 scoreless innings and the Arizona Diamondbacks rallied to beat the Philadelphia Phillies 2-1 on Thursday and close to 2-1 the NL Championship Series.

On the verge of falling behind 3-0 in the best-of-seven series, Arizona tied the score on Lourdes Gurriel Jr.’s RBI double.

Gurriel opened the ninth with a leadoff walk off Craig Kimbrel, stole second and took third on Pavin Smith’s infield single.

Gurriel was thrown out at the plate by shortstop Trea Turner on Emmanuel Rivera’s hard-hit grounder as the Phillies played the infield in. Geraldo Perdomo walked after falling behind 1-2 in the count and Marte — one of the few Diamondbacks who has looked comfortable at the plate this series — hit a liner that fell in front of center fielder Johan Rojas, sending the D-backs onto the field in celebration.

Bryce Harper had put the Phillies ahead in the seventh when he scored on Ryan Thompson’s wild pitch.