The Baltimore Orioles maintained their tie with the Yankees on top of American League East, beating the Tampa Bay Rays with a walk off win 3-2 on Wednesday night.

Rookie Manny Machado scored the game-winning run in the bottom of the ninth and also made a clutch defensive play in the top of the ninth to keep the Rays from scoring.

Tied 2-2, with Rich Thompson on second and two outs, Rays third baseman Evan Longoria hit a pitch hard down the third baseline towards Machado. The 20-year-old then faked a throw to first as Thompson began to run towards home and tossed the ball to shortstop JJ Hardy, catching him in a run down. Catcher Matt Wieters eventually tagged him out, saving a run and leaving room for more heroics.

"I was trying to get Evan out to be honest, but then when I came up I saw I had no chance," Machado told the Associated Press. "So I did a pump-fake and tried to deke the runner. It was just natural. I just came out and didn't think about it."

Hardy was impressed with the play.

"He was smart. I don't know if he would have been able to throw out Evan," Hardy said. "I know (Longoria) is running a little slow with his hamstring, but for Manny to do what he did, it just shows you how aware he is at 20 years old. I think he's really impressed me."

The Rays were just as impressed with the rookie as the Orioles were.

"His poise and his calmness, he's not taken in by the moment at all," Tampa Bay manager Joe Maddon said. "That was an example of his calmness right there. He's really aware of everything that's going on around him. For him to do that in that situation is impressive. He has the maturity of a veteran."

In the bottom of the inning, Machado made it on base with a single off Kyle Farnsworth before outfielder Nate McLouth smashed a ball to deep right field. It hit the wall in the outfield merely two feet inside the foul pole for a fair ball and allowed Machado to score the game winning run.

The Orioles game was finished before the New York Yankees and Boston Red Sox game, so the Baltimore led the division by .5 games for at least a little bit of time. The Yankees beat the Red Sox 5-4 to keep pace atop the division.

The Yankees and Orioles are now tied for first place in the AL East with identical 80-62 records.

Baltimore is 18 games over .500 for the first time since they made the playoffs in 1997. The Orioles have a chance at a three-game sweep of the Rays if they can win on Thursday.

The Rays took an early lead of BJ Upton's first inning home run, but gave it back in the bottom half of the inning, giving up two runs. Ben Francisco tied the game for the Rays in the third on a double to left field and the game stayed that way until McLouth's heroics in the ninth.

Rookie starter Miguel Gonzalez was solid for Baltimore, allowing only two runs and six hits in six innings of work. Jim Johnson (2-1) was credited with the win after shutting down the Rays in the top of the ninth inning.

Tampa starter Alex Cobb came into the game 5-0 in his last eight starts, but only lasted 4 2/3 ininings after giving up two runs on seven hits.

The Rays had a chance to add runs in the sixth after having runners on second and third with only one out. But Gonzalez struck out Ryan Roberts before getting Jose Molina to ground out to first base.

On Thursday the Rays will throw Jeremy Hellickson (8-10), while the Orioles will counter with rookie Wei-Yin Chen (12-9).