BALTIMORE -- Playing on the road against a playoff-quality team, Philip Rivers would have been delighted with a win no matter how it occurred.
San Diego trailed the entire game until Rivers capped a 1-yard touchdown pass to Eddie Royal with 38 seconds to go, giving the Chargers a 34-33 victory.
The Chargers (8-4) trailed 30-20 with 6:13 remaining and 33-27 with 2:22 left before Rivers brought them back.
"These are the kind of games you got to win to get in (the postseason) and these are the kind of games you got to win if you do get in," Rivers said. "I'm not saying you're going to win all of them, but if you can't win these, you're not good enough."
Each team punted just once. Both offenses were clicking all day long, which made the outcome all that much sweeter for Rivers.
"Just the way we won. It was back and forth, back and forth, never quit," he said. "We got one more point than they had."
Following a pass interference call against Anthony Levine in the end zone, Rivers hit Royal to conclude an 80-yard drive and give the Chargers their third straight victory.
Rivers went 34 for 45 for 383 yards and three touchdowns, two to Keenan Allen.
"Tip our hat to the Chargers and Philip Rivers," Ravens coach John Harbaugh said. "Obviously, a great quarterback and that made the difference."
Baltimore (7-5) lost at home in November for the first time since 2009. The Ravens, who were 11-0 all-time at home against West Coast teams, fell 1½ games behind AFC North leader Cincinnati.
The defense accepted the blame, even though it forced two turnovers.
"In the NFL, nothing is game, set, match as long as there is time on the clock," linebacker Terrell Suggs said. "We're up 10 at home in the fourth quarter and our offense gave us 33 points and usually that's enough. It wasn't. That's why this is extremely disappointing."
The Ravens last lost a game when they scored 30 points in October 2009, a 33-31 defeat at Minnesota. The last time it happened at home was in 2007, 33-30 in overtime against Cleveland.
It was 23-20 before Flacco directed a 12-play drive that seemingly provided the Ravens with some breathing room. A 31-yard completion to Jacoby Jones, followed by a pass interference call against Shareece Wright, led to the third-down quarterback sneak that made it a 10-point game.
Rivers responded with a 77-yard drive, capped by a 23-yard touchdown pass to Allen with 3:40 remaining.
Jones took the kickoff 72 yards to the San Diego 30, setting up Tucker's fourth field goal. It wasn't enough for the Ravens, who hadn't lost at home since the season opener.
San Diego, on the other hand, got off to an excellent start in a season-ending stretch drive that began in Baltimore and concludes with games against New England, Denver, San Francisco and Kansas City.
"The players never gave up and we just kept plugging away," coach Mike McCoy said. "That's what good teams do. The character of our team once again showed up, and when you've got a great quarterback like Philip Rivers, you got a chance to win every game just as long as there's time left on the clock."
On the ensuing drive, Flacco misfired from the San Diego 39. But Eric Weddle inexplicably pushed Flacco to the ground, drawing a roughing-the-passer penalty. Five plays later, Flacco connected with Torrey Smith on a 10-yard pass for a 23-13 lead.
San Diego's only punt came with two minutes left in the third quarter. The Ravens' lone punt occurred with 23 seconds to go in the period.
The Chargers converted all seven third-down tries in the first half, but Baltimore took advantage of two turnovers and scored on all four of its possessions for a 16-10 lead.
Forsett went over 1,000 yards for the first time in his seven-year career. He's at 1,009. ... Baltimore WR Marlon Brown landed hard on his back after making a first-down catch in the first quarter and left with a concussion. ... Chargers C Chris Watt took a hit on his calf in the third quarter and did not return.