The Diamondbacks ended a three-game losing streak that wiped out the last of their hopes of overtaking the Los Angeles Dodgers for the NL West title.
Colorado scored three times in the first inning, but Justin Upton homered in the fourth and Stephen Drew had a solo blast in the fifth to draw the Diamondbacks within a run. Justin Upton's two-run triple later in the fifth put Arizona in front, but the Rockies forged a 4-4 tie going into the eighth.
Tracy then came through with his key hit to make a winner out of Juan Cruz (4-0), who worked out of an eighth-inning jam.
Chad Qualls struck out two in the ninth for his eighth save.
Jason Grilli (3-3) gave up Tracy's hit to take the loss.