Arizona overcame an early two-run deficit, let a three-run lead get away in the seventh and then staged another comeback in the eighth.
The Diamondbacks loaded the bases with one out in the eighth before Prado delivered his clutch single.
Arizona then preserved the victory in the ninth when Evan Longoria grounded into a double play against Brad Ziegler after the Rays had put two men on with one out. It was Ziegler's seventh save and ensured the win for J.J. Putz (3-1), the fifth Arizona pitcher who worked around a base hit in the eighth.
Joel Peralta (1-5) gave up Arizona's runs in the eighth to take the loss.
Tampa Bay briefly took the lead with a four-run seventh, during which Longoria doubled in two runs and Sam Fuld singled in two more.
The teams combined for 28 hits, 16 of them by the Rays.