OAKLAND, Calif. (AP) Derek Carr and the Raiders gave their football-starved fans quite a show in their first game back in Oakland in seven weeks.

Carr threw a 9-yard touchdown pass to rookie Hunter Renfrow with 2:04 remaining and Karl Joseph broke up a fourth-down pass in the end zone with 3 seconds left to give the Raiders a 31-24 victory over the Detroit Lions on Sunday in their first game back in Oakland since Week 2.

''I love this place. It's special,'' Carr said. ''To come home in front of them and get a win, especially the way we did it. It would be nice to win something 40-0 some time. But when you win one like this, it does so many good things for a team.''

After surviving an odyssey that forced them to travel about 20,000 miles for four road games and a neutral site game in London, the Raiders (4-4) came back home for the first time since losing to Kansas City on Sept. 15. They put on quite a show for the fans who are hoping the Raiders can put together a successful season before their planned move to Las Vegas next year.

Carr's clutch pass to Renfrow gave Oakland the win to start the crucial three-game homestand. Carr also connected with rookie Foster Moreau on a 3-yard score opening seconds of the fourth quarter and another rookie, Josh Jacobs, ran for 120 yards and two scores . It was the first time since the merger that the Raiders got four TDs from rookies in a single game.

Matthew Stafford threw for 406 yards and three touchdowns but came up short at the end as the Lions (3-4-1) lost for the fourth time in five games.

''It's a tough pill to swallow,'' Lions linebacker Devon Kennard said. ''The last few weeks have been on us defensively. I feel like if we'd play better defensively we'd be in a much better position right now. But you can't panic. It's halfway through the season. We've got eight more games left, a lot of ball to be played. I believe in the guys in this locker room. We have to get this fixed. It starts with defense, controlling what you can control. Once we do that we'll be all right.''

Stafford moved Detroit down to the 1 in the closing seconds. On the Lions final play, he threw the ball up for tight end Logan Thomas but Joseph was there to prevent the catch, sealing the victory for the Raiders.

''I give a lot of credit to him,'' Thomas said. ''He made the play. I thought I had a good shot. I feel personally that I should be able to make the play.''

Carr threw for 289 yards and connected on passes of 31 and 23 yards to Jalen Richard on the game-winning drive. Then with Oakland facing a third down, Carr scrambled to extend the play before finding Renfrow in the front corner of the end zone.

''I saw it in his eyes today,'' Richard said of Carr. ''It's in his eyes all the time, but in times where you really, really need it, you just look at him and you just see that greatness coming and you're like, `OK, he's going to give us an opportunity so we got to make the plays.'''

The offenses dominated the first three quarters with neither team punting during that stretch. The Raiders went ahead 24-17 on Carr's 3-yard TD pass to rookie Foster Moreau in the opening seconds of the fourth quarter.

Both teams then traded punts over the next four possessions before Stafford and the Lions struck back with a 26-yard touchdown pass to J.D. McKissic that tied the game with 5:16 remaining.

TURN IT OVER

The Raiders capitalized on two turnovers in the first half to take a 17-14 lead. Maurice Hurst recovered a botched handoff from Stafford to McKissic on Detroit's opening drive and Oakland turned that into a 68-yard TD drive capped by Jacobs' 2-yard run.

Daryl Worley then intercepted a pass by Worley in the end zone with the Lions looking to build on a 14-10 lead. Oakland drove 80 yards and scored on Jacobs' 3-yard run to make it 17-14 at the half.

ROOKIE RECORD

Jacobs had another strong performance and broke Marcus Allen's franchise rookie record for rushing on a 16-yard run late in the first half. Jacobs now has 740 yards rushing through eight games, breaking the mark of 697 set by Allen in the nine-game, strike-shortened 1982 season.

MOVING UP

Stafford's 59-yard TD pass to Kenny Golladay in the second quarter gave him 255 TDs in his career, passing Hall of Famer Dan Fouts for 20th place in NFL history. Stafford also passed Drew Brees for the third most yards passing in his first 11 seasons with 41,205 .

INJURIES

Lions: Rookie TE T.J. Hockenson was not on the field for the final drive but coach Matt Patricia had no update on his condition.

Raiders: RT Trent Brown hurt his knee on the opening drive. He tried to come back on the second drive before leaving once again and not returning.

UP NEXT

Lions: Visit Chicago on Sunday.

Raiders: Host the Los Angeles Chargers on Thursday night.

---

More AP NFL: https://apnews.com/NFL and https://twitter.com/AP-NFL

Copyright 2019 by STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.