OAKLAND, Calif. — After too often finding themselves on the wrong end of close games a year ago, the Oakland Raiders have thrived in those situations this season.

Derek Carr and the Raiders found a new way to win Sunday, using a go-ahead, fourth-down 21-yard touchdown pass to Michael Crabtree and a botched hold on a potential tying field goal to beat the San Diego Chargers 34-31 .

“Guys have a lot of confidence because we work really hard especially in those situations,” Carr said. “We spend a lot of time throwing routes, spend a lot of time going over coverages, spend a lot of time in two-minute drills, end of game situations. You hang our hat on we’ve done this before. Let’s be confident when we get on the field.”

After using a late 2-point conversion to win the opener, stopping a late Tennessee drive in a Week 3 win and using a late score and defensive stop to beat Baltimore last week, the Raiders (4-1) survived against the Chargers (1-4) to post their first three-game winning streak in five years.

That has put an Oakland team that hasn’t made the playoffs since 2002 in a tie for first place in the AFC West with Denver.

“It’s nice, but the road still goes through Denver,” Carr said. “They are Super Bowl champs, division champs. I will always pay respect to them because that’s what they’ve earned. We have earned absolutely nothing yet.”

The Chargers know just as well how small the difference can be from winning and losing — only they seem to always be at the wrong end.

San Diego had already lost three games it led at the two-minute warning, blowing a 21-point lead to Kansas City and a 13-point fourth-quarter advantage last week versus New Orleans.

Then came the latest loss that was sealed when Drew Kaser couldn’t hold the snap on a 36-yard field goal attempt that could have tied the game.

“Just when you think you’ve seen it all, something like that happens,” coach Mike McCoy said.

Here are some other takeaways from the game:

BOSA’S DEBUT: Chargers defensive end Joey Bosa made an impressive debut after missing training camp during a nasty contract dispute and sitting out the first four games with a hamstring injury. He came in on the second drive and had a sack and a tackle for loss in the first half. He added a second sack in the fourth quarter.

“It felt pretty natural,” Bosa said. “It’s nice to get the butterflies out because I was pretty nervous coming into this game.”

VALUABLE FILL-IN: The Raiders signed Perry Riley Jr. on Tuesday and put the former Washington linebacker right into the mix. With Malcolm Smith hindered by a quadriceps injury, Riley got the start. He forced a fumble by Antonio Gates on the opening drive and finished with seven tackles.

“I knew when we got him what he was going to bring to the table,” linebacker Bruce Irvin said. “Tough, hard-nosed competitive guy who makes plays. He showed that on the first possession.”

ROUGH DAY: Kaser had tough day even before the botched hold. He punted just once and shanked that attempt for just 16 yards. Oakland took over on the 32 and drove for a TD that made it 34-31.

COOPER SCORES: Raiders receiver Amari Cooper hadn’t scored a touchdown in four games before breaking through against the Chargers. He scored on a 64-yard pass from Carr in the third quarter and added a 2-point conversion after Crabtree’s TD. Cooper also nearly had three more scores, but couldn’t get both feet down inbounds on two throws into the end zone and was unable to re-establish himself after being interfered with on a third play.

“First one is always the hardest, no matter what it is,” Carr said. “I’m just happy for him because he works his tail off.”

DIVISION SHOWDOWNS: Both teams remain in the division next week with the Chargers hosting the Broncos on Thursday night and the Raiders hosting Kansas City on Sunday.

AP NFL website: www.pro32.ap.org and www.twitter.com/AP_NFL