Only one person could have dreamed up what the Texas Rangers did late Tuesday night and that person was the player who won the game for them in improbable fashion.

Outfielder Leonys Martin hit a three-run walk-off homer in the 10th inning to complete the Rangers’ comeback from a four-run deficit in the eighth inning and into a 14-11 victory over the Los Angeles Angels of Anaheim.

Martin said afterward that he dreamt about delivering a game-ending home run Monday night after teammate Geovany Soto had hit a walk-off homer hours earlier in the opener of the three-game series.

“The biggest moment I’ve had in my whole career” Martin said. “Last night I had a dream like that and it came true tonight. Because of the game that happened with Soto I dreamed about it.”

The Rangers gained ground on first-place Oakland which leads the division by five games for the first time since June 27 after winning in their final at-bat for a second straight game. This walk-off victory rates as even more unlikely than the one Monday.

The Angels led 11-7 after scoring four times against Tanner Scheppers in the eighth but Soto smacked a three-run homer with two outs in the bottom of the inning to move the Rangers within striking distance.

The Rangers were down to their final out against Ernesto Frieri in the ninth when Ian Kinsler drew a walk and stole second without a throw. The next batter Adrian Beltre dropped a single into left field and Kinsler slid home ahead of the throw from J.B. Shuck to tie the game.

After Joe Nathan pitched around a leadoff walk to Mike Trout in the 10th Mitch Moreland and Soto reached against Daniel Stange to open the home half. The next batter David Murphy beat out a throw to first as the Angels tried to turn a double play on his grounder to third.

With Moreland at third the Angels moved right-fielder Collin Cowgill into the infield and left Shuck and Trout playing the gaps in the outfield. Martin caught a high fastball and sent it just over the left-field wall to send the Rangers into a state of euphoria for a second straight night.

“We need to win games any way we can and tonight was a long hard-fought battle” Kinsler said. “We didn’t give up. We played to the end and pulled out a win so it was a good win tonight.”