McNair engineered a 74-yard drive in the fourth quarter and Joe Nedney kicked a 21-yard field goal with 1:47 remaining as the Tennessee Titans kept alive their playoffs hopes with a 13-10 victory over the sputtering Raiders.
Battling a sore groin, Sebastian Janikowski had a chance to force overtime but pulled a 42-yard field goal with six seconds left for his third miss of the night. He had converted 21-of-23 attempts in the first 13 games of the season.
"He's been unbelievable, phenomenal this year. Tonight, he hit a bump in the road," Raiders coach Jon Gruden said.
"My groin hurt a little bit, but it didn't make any difference," said Janikowski.
The loss dropped Oakland 1 1/2 games behind Pittsburgh in the battle for home-field advantage throughout the AFC playoffs.
"We did not make enough plays to win," Gruden said. "We didn't take advantage of our scoring opportunities tonight and missed three field goals. Maybe a couple of balls that could have been handled that weren't."
McNair completed 3-of-4 passes for 62 yards on the go-ahead drive, twice connecting with Derrick Mason for long gains on third down. He hit Mason for 29 yards on an out pattern on 3rd-and-7 to the Raiders' 32, then threaded a 22-yard completion to Mason on 3rd-and-10.
"It was two unbelievable throws," Gruden said. "One of them, McNair, I think he was falling down or being hit while he threw it. He threw that ball so early. ... Derrick Mason made a great catch. He ran a great route on third down and the ball again was thrown off the screws perfectly where it had to be, right out of Charles Woodson's desperate attempt to knock it down."
Four plays later, Nedney kicked his second field goal of the game, and the Titans (7-7) barely held on for their seventh win in 11 games.
"You can't look back on one or two particular games to dwell on the playoff hunt," said Tennessee's Eddie George, who rushed for just 23 yards on 11 carries. "But things happened for a reason and we are playing some good ball right now. And who knows what can happen in the next few weeks."
McNair has won 11 of his last 12 regular-season starts in December and January and improved to 3-0 lifetime against Oakland.
"In the end, when we needed to find a rhythm, we found a rhythm that put ourselves in a good position to kick a field goal and win the game," said McNair, who completed 15-of-27 passes for 178 yards.
Rich Gannon was 29-of-50 for 249 yards with a touchdown and an interception for the Raiders (10-4), who have looked unimpressive in splitting their last four games.
"When you are playing this time of year, you've got to take advantage of your opportunities," Gannon said. "We've been able to complete drives, score touchdowns and make our field goals in the red area and tonight, we weren't able to do that."
The teams battled through a scoreless first half, with Janikowski pulling a 40-yard field goal attempt with just over three minutes left in the second quarter.
Tennessee sprung to life in the third quarter, taking the second-half kickoff and moving 65 yards in 12 plays. The key play was a 36-yard pass interference penalty on cornerback Eric Allen that put the Titans on the Raiders' 9-yard line.
Oakland went three-and-out and Tennessee finally reached the end zone on its next possession. Skip Hicks, spelling an injured George, carried five times for 32 yards before McNair found Kevin Dyson for a 30-yard touchdown that made it 10-0.
The Raiders got going at the end of the third quarter. Two plays after the kickoff, Gannon made an underhanded flip to running back Charlie Garner, who raced 25 yards to the Oakland 49. Gannon hooked up with Jerry Rice for a 40-yard gain, then found tight end Roland Williams in the front of the end zone from four yards to get the Raiders within 10-7.
On the next play from scrimmage, Allen atoned for his penalty by intercepting a pass that sailed on McNair and returning it 19 yards to the Titans' 22. Janikowski tied it with a 35-yarder with 12:59 remaining in the final period.
Oakland had the momentum, forced Tennessee to punt and moved deep into Titans' territory before Janikowski pushed a 33-yarder wide left.
"I'm not going to blame a lack of accuracy tonight on anything. He was cleared to play physically," Gruden said. "He looked a little abrupt. I think the film will indicate he was quick in his approach to the football. And when he does that, he gets a little bit inaccurate."