"We're in the same position as last year where we had to win the last couple of games," McGahee said. "Once we get in there, we know we can do damage, and now we're in there."
The Ravens (9-7) went into the regular-season finale knowing a win would put them in the playoffs and a loss would send them home for an early winter. Just like last season when they beat Jacksonville in the final game to make the postseason, the Ravens came through against the Raiders.
Baltimore will open the playoffs next weekend at New England. The Ravens are 0-5 all-time against the Patriots, including a 27-21 loss at New England on Nov. 4.
"In my 14 years, I've never had a pretty road to the playoffs," linebacker Ray Lewis said. "It's always been a grind, but there's no better thing than having that grind and getting to advance. I like where we're positioned right now, and I like all the adversity we've gone through. I just like seeing this team fight."
The Raiders (5-11) provided a stiff challenge for much of the game but were unable to pull it out in the end behind former starter JaMarcus Russell.
Dannell Ellerbe intercepted a pass from Russell late in the third quarter to set up McGahee's third touchdown that made it 21-13. Ellerbe then recovered a fumble by Russell at the Ravens 23 with 9:42 to go to end a possible scoring threat by Oakland.
After a three-and-out for the Raiders, McGahee iced the game with a 36-yard run on third-and-4 from his 15 to cap his first 100-yard rushing game of the season.
"Willis took over the game the way he ran," coach John Harbaugh said. "I think our offensive line deserves a lot of credit. Obviously there were holes, but this guy was running north and south. He was powerful, he was explosive, and I think he's worked really hard all season to have this kind of game."
The loss gave the Raiders seven straight seasons with at least 11 defeats, the worst run in NFL history. It also could mark the end of coach Tom Cable's stint in Oakland as his job status will likely be decided in the next few days.
Cable made some progress in his 28 games as Raiders coach but his inability to develop Russell into a legitimate NFL starter may ultimately doom him. He said he's confident he'll be back next season but has received no reassurances from owner Al Davis.
"I'm disappointed because we didn't win," Cable said. "I thought we were going to. And yet I feel excited about what's coming back. But there's got to be some things added and tweaked and fixed."
Russell was benched midway through this season and came on in relief in three of the final seven games, including in the second half Sunday after Charlie Frye left with an injured ankle and back.
Russell led a comeback in Denver two weeks ago and appeared poised to do so again after directing the Raiders to a field goal that cut Baltimore's lead to 14-13 late in the third quarter. But his two turnovers brought out the boo birds in Oakland and provided a fitting end to a disappointing third season for the former No. 1 overall pick. Russell committed 17 turnovers while throwing only three touchdown passes all season.
"You can't turn the ball over when you're playing a team as good as the Ravens," Russell said.
The Ravens struck first when McGahee scored on a 2-yard run to cap Baltimore's second drive. It was McGahee's touchdown in the second quarter that was truly highlight-reel material.
He took a handoff at the 23 and burst through the line. With Eugene in position to make a tackle near midfield, McGahee stiff-armed him to the ground and took it in the rest of the way for a 14-3 lead.
"I wasn't expecting it to work that way," McGahee said. "I was shocked just like everyone else was shocked. I knew I was gonna stiff arm, but I didn't know he was going to fall backward. There's no going back, though; you got to keep going forward."
Frye responded by leading the Raiders on a 79-yard drive capped by a 12-yard touchdown pass to Zach Miller in the final minute of the half. Billy Cundiff missed a 37-yard field goal attempt wide right on the final play of the half, keeping Baltimore's lead at 14-10.
Baltimore RB Ray Rice joined Jamal Lewis as the only Ravens with 2,000 yards from scrimmage in a season. He finished with 2,041. ... The seven points for Raiders K Sebastian Janikowski gave him 1,000 for his career. ... Oakland P Shane Lechler set a single-season record with a 43.9-yard net punting average. His 51.1-yard gross average fell just shy of Sammy Baugh's mark of 51.4 yards set in 1940.