BALTIMORE (AP) -- The Boston Red Sox celebrated a rare September victory for about 20 minutes before turning their attention toward their next game - the last and most important of the 162-game schedule.
The Red Sox maintained a share of the AL wild-card lead Tuesday night, using four home runs to beat the Baltimore Orioles 8-7 and set up a dramatic conclusion to the regular season.
The skidding Red Sox were 6-19 this month before rebounding to edge the last-place Orioles. The win, combined with Tampa Bay's 5-3 victory over the New York Yankees , kept Boston and the Rays tied with one game left.
After blowing a nine-game lead in the span of 23 days, the Red Sox will send Jon Lester (15-9) to the mound against Baltimore on Wednesday night in an effort to get into the postseason for the fourth time in five years. Lester, Boston's winningest pitcher, will be throwing on three days' rest.
A month ago, the Red Sox would shudder at the prospect of a must-win situation on the final day. But here they are, and they intend to make the best of it.
"I think it's really good for baseball, not so good for my stomach," manager Terry Francona said. "It's exciting. If you don't want to show up (Wednesday) and play, you've got no pulse. My goodness, I can't remember being that nervous in a long time. Go back to the hotel and not sleep, and then show up and see what we can do."
Boston will be looking to put together its first winning streak since sweeping a doubleheader from Oakland on Aug. 27. If the Rays and Red Sox remain tied after Wednesday, Tampa Bay will host a one-game playoff Thursday.
"Everybody's been watching the scoreboard and knowing that we need to win tonight so we can come back (Wednesday) and fight through it again," Boston slugger David Ortiz said. "I hope if I'm still here next year we can make it easier. We're playing like this is a playoff already."
Rookie Ryan Lavarnway became the unlikeliest of heroes for Boston, hitting his first two major league homers after being thrust into the lineup because of injuries to catchers Jarrod Saltalamacchia (sore collarbone) and Jason Varitek (knee).
Lavarnway, a Yale philosophy major who never played a big league game before August, hit a three-run drive in the fourth inning and added a solo shot for an 8-4 lead in the eighth.
"Besides what he did offensively, I thought he ran the game, I thought he had a lot of poise," Francona said. "That was one of the more exciting things to watch. We've seen a lot of interesting things here over the years, but that was right near the top."
Lavarnway said, "It feels good, but the job's not done. We still got to go out (Wednesday) and win another ballgame."
Jacoby Ellsbury and Marco Scutaro also connected for Boston, which scored all its runs on home runs.
Alfredo Aceves (10-2) pitched 3 2-3 innings of three-hit relief for the Red Sox, who survived homers from Baltimore's Matt Wieters and Adam Jones .
After the Orioles scored twice in the eighth off Daniel Bard to make it 8-6, Jonathan Papelbon survived a hectic ninth for his 31st save. Wieters drove in a run with a grounder and Baltimore had the potential tying run at second with two outs before Jones grounded out on a 3-2 pitch.
"Everything we got, we needed," Francona said. "We hung on for dear life."
Said Jones: "We battled down to the final pitch. That's the way I live. You know we ain't going to quit."
Pitching at Camden Yards for the first time since being traded by Baltimore to Seattle in February 2008, Boston starter Erik Bedard gave up three runs and five hits in 3 1-3 innings. The left-hander struck out six but needed 84 pitches to get 10 outs.
Bedard retired the first two batters without difficulty, then walked Nick Markakis and yielded an RBI double to Vladimir Guerrero to fall behind 1-0.
Boston took the lead in the third against rookie Zach Britton (11-11) when Scutaro hit a two-out double and Ellsbury followed with his 32nd homer. Ellsbury has hit in 35 straight games against the Orioles, a streak that began on April 17, 2009.
Lavarnway connected on a 3-2 pitch in the fourth following singles by Ortiz and Adrian Gonzalez . Wieters answered in the bottom half with his 22nd home run, the second in two nights, to make it 5-3.
A triple by Carl Crawford and Scutaro's homer off Jason Berken made it 7-3 in the sixth. Jones led off the bottom half with a homer off Aceves.
NOTES: Boston's Jed Lowrie started in the cleanup spot for the first time in his career. He went 0 for 5 with two strikeouts. ... Saltalamacchia was available if needed. Before the game he said, "I feel good, I feel like I can perform, but if it takes today to be 100 percent tomorrow, then that's what we'll do." ... Francona said RHP Clay Buchholz , who's on the 60-day DL with a back strain, could find his way onto the postseason roster. ... For the second time in two nights, play was interrupted when a fan ran onto the field. ... Boston starters have a 7.28 ERA in September. ... Alfredo Simon will pitch Wednesday for the Orioles.