The Yankees trailed 3-2 entering the bottom of the eighth inning of the 8-3 win Tuesday at Yankee Stadium.
Gleyber Torres walked in the first at-bat in the bottom of the frame before Brett Gardner struck out and D.J. LeMahieu lined out.
Judge then stepped into the box to face Rays reliever Colin Poche. The Yankees slugger worked a full count against Poche, before the left-handed pitcher issued a 95.6 mph fastball. Judge drilled the pitch into the right center field seats for his 10th home run of the season, giving the Yankees a 4-3 edge.
Gregorius fell behind 0-2 in the count before taking a pitch for a ball. He then smacked a 1-2 fastball over the right center field wall for a 406-foot grand slam. The blast had an exit velocity of 100 mph and left the field in 5.5 seconds, according to Statcast.
"I finally came through for the team," Gregorius said. "I've been in situations and couldn't come through. I was finally able to come through, especially against the lefty. That makes it even better."
Judge's two-run shot went 367 feet and had an exit velocity of 101 mph.
The Rays took their initial lead with a solo shot from Austin Meadows in the top of the second inning. Encarnacion tied the score with his 28th home run of the season in the bottom of the same inning. Yandy Diaz then came through for the Rays, hitting a solo home run in the fourth inning and an RBI double in the sixth frame.
LeMahieu answered for the Yankees with a solo home run in the bottom of the sixth inning.
The Yankees take on the Rays in the third game of the four-game series at 7:05 p.m. EDT Wednesday in New York.