D-backs survive late comeback attempt by Pirates in 12 innings

This browser does not support the video element.

PITTSBURGH -- Phew, this would've been a bad loss for the Diamondbacks.

Arizona blew a six-run lead in the eighth and ninth innings to send the game to extras. Eventually, James McCann was able to break through with an RBI single in the 12th inning to beat the Pirates, 8-7, on Tuesday night at PNC Park.

The win snapped a three-game losing streak, and broke a tie between the two teams for the third NL Wild Card spot.

Arizona led 6-0 with two outs in the eighth inning before reliever Ryan Thompson allowed four straight hits as three runs came across.

Brandyn Garcia was able to escape the eighth without further damage. Closer Paul Sewald came on for the ninth with a three-run lead that quickly disappeared when Jake Mangum led off with a double. Brandon Lowe and Bryan Reynolds then hit back-to-back homers to tie the game.

More from MLB.com