BALTIMORE (AP) — Philip Rivers was almost speechless. The Chargers had just absorbed another narrow defeat, and the standout quarterback had no clue how to solve the problem.

Justin Tucker kicked a 39-yard field goal as time expired, and the Baltimore Ravens withstood a record-setting performance by Rivers to beat San Diego 29-26 Sunday.

Rivers went 28 for 37 for 301 yards, his franchise-record fifth straight 300-yard game. He also threw for three touchdowns, two to Malcolm Floyd.

But the Chargers (2-6) lost their fourth straight — a run that includes three defeats on the final play.

"It’s been tough losing this way," Rivers said. "For once, I don’t have a whole lot to say, really. I don’t have a whole lot of answers."

Tucker’s fifth field goal came three plays after a third-down pass interference call against Steve Williams moved the ball 21 yards to the San Diego 22.

"We had an opportunity to do it and we didn’t get it done," coach Mike McCoy said. "It’s another one of those games that comes to the bitter end."

Bitter for the Chargers, that is.

"I’m not one to say you’d rather get beat 35-0 every week than have close games, because I can’t imagine how that would feel," Rivers said. "But I think it does make it tougher when it’s like this."

Baltimore went ahead 26-23 with 4:34 to go when Joe Flacco scored on a quarterback sneak to end a concise 38-yard drive that followed a 17-yard punt return by Jeremy Ross.

Rivers began the ensuing drive with a 26-yard pass to Danny Woodhead, and the Chargers pulled even on a 49-yard field goal from Josh Lambo with 2:07 remaining.

But the Ravens answered. One week earlier in Arizona, and in the opener at Denver, Baltimore came up short with a chance to win in the waning minutes.

This time, the Ravens (2-6) prevailed.

"To have our guys come through the way that they did, that’s just a wonderful thing," coach John Harbaugh said.

The victory came at a price: receiver Steve Smith tore his right Achilles tendon in the third quarter and is lost for the season. After being tackled at the end of an 18-yard gain, the 36-year-old Smith had to be helped off the field and could not put any weight on his right leg.

Now in his 15th NFL season, Smith has said he will retire after this year. He had five catches for 82 yards before the injury.

Flacco went 25 for 37 for 319 yards and also faced the challenge of handling some off-the-mark shotgun snaps from John Urschel, who replaced injured center Jeremy Zuttah in the second half.

"My snaps weren’t very good," Urschel acknowledged.

In a back-and-forth game, San Diego went up 23-16 in the third quarter when Rivers beat a blitz to connect with Floyd for a 70-yard score. Rivers threw the pass an instant before getting tackled by free safety Kendrick Lewis, who vacated his usual spot deep in coverage to pursue the quarterback.

It was Rivers’ longest completion since 2012 and the longest of Floyd’s career.

Baltimore responded with Tucker’s fourth field goal, a 45-yarder on the final play of the quarter.

Rivers completed 19 of 22 passes in the first half. His second touchdown pass provided the Chargers with a 16-13 lead at the break.

Baltimore got a field goal on its opening drive of the second half to knot the score at 16.

NOTES: San Diego had to play with a makeshift offensive line. LG Orlando Franklin (ankle) was inactive; LT King Dunlap limped off with an ankle problem in the first quarter and was replaced by Chris Hairston, who briefly left the game with a knee injury but returned. Center Chris Watt sustained a shoulder injury and Trevor Robinson subbed for him. … Zuttah and TE Crockett Gillmore both left with arm injuries for Baltimore.