Down 7-6 in the final frame, Brett Phillips became the unlikely hero when he singled to shallow right-center field to score Kevin Kiermaier and Randy Arozarena on a sequence that involved a pair of Dodgers misplays.
Kiermaier blooped a single with one out off closer Kenley Jansen and Arozarena walked with two outs. Phillips then hit a soft single that center fielder Chris Taylor misplayed as the tying run scored.
Arozarena appeared to be caught in a rundown when he stumbled on his way to home, but Dodgers catcher Will Smith was unable to handle the relay throw as he spun his glove around for the tag.
The ball rolled to the backstop, and Arozarena slid into home for the game-winning run.
"Golly, what a special moment," said Phillips, who was 0 for 2 in the playoffs and hadn't batted since Game 3 of the AL Division Series on Oct. 7. "Once I saw Randy slip, I was like, 'Aw, shoot, at least we tied it up.' And then he missed the ball.
"I don't know what happened, but then he scored. The next thing I know I'm airplane-ing around the outfield and I get dogpiled and here I am."
With the Rays' late heroics in a game that spanned a little more than four hours, Tampa Bay prevented the Dodgers from taking a commanding 3-1 lead in the championship series. Game 5 of the best-of-seven series is set for Sunday night.
Justin Turner put the Dodgers in front with a solo homer to center in the first inning. In the third, Corey Seager, the 2020 National League Championship Series MVP, extended the Dodgers' lead to 2-0 with his 411-foot solo shot.
Arozarena, the rookie sensation who was this year's American League Championship Series MVP, cut the Rays' deficit to 2-1 with his record-breaking home run in the fourth.
It was his ninth home run of the 2020 playoffs, setting the MLB record for the most homers hit in a single postseason. He broke a tie with Barry Bonds (2002), Carlos Beltran (2004) and Nelson Cruz (2011).
The Dodgers answered with Max Muncy's RBI single that scored Seager in the fifth. Later in the inning, the Rays again bashed a home run off Dodgers starter Julio Urias. Hunter Renfroe belted a 444-foot solo homer to left, trimming the Dodgers' lead to 3-2.
Los Angeles made it a two-run game in the sixth when Enrique Hernandez doubled home a run. In the bottom half of the inning, the Rays -- trailing since the first inning -- stormed ahead with Brandon Lowe's three-run homer off Pedro Baez.
But the Dodgers responded in the seventh with Joc Pederson's two-RBI single. The two-run single gave the Dodgers a 6-5 advantage entering the late stage of the game.
The Rays then tied the game in the seventh after Kiermaier blasted a 426-foot solo home run to make it 6-6. Seager struck again in the top of the eighth, scoring the go-ahead run with a single.
The Dodgers, on the verge of a 3-1 lead in a push for their first title since 1988, took a 7-6 lead into the ninth. But the Rays managed to conquer Jansen on the improbable final play.
"You got to stay positive," Jansen said. "I didn't give up one hard hit. What can I do? Throw the pitches where I wanted to. Credit to the hitters."
Clayton Kershaw is expected to start for the Dodgers in Game 5, while Tyler Glasnow will take the mound for the Rays.