With a Hail Mary move, Denny Hamlin ended Joe Gibbs' 23-year drought at the Daytona 500.

Gibbs made it clear that he had no use for the victories his drivers collected in the exhibition races leading into Sunday's season-opener. The three-time Super Bowl winning coach was focused only on the "Great American Race" and his four drivers brainstormed on the best way to get a win for Gibbs.

Hamlin, Matt Kenseth, Carl Edwards and reigning NASCAR champion Kyle Busch stuck close together for most of the race, and they got assistance from Martin Truex Jr., who became a de facto JGR teammate this year when Furniture Row Racing moved to Toyota.

Kenseth was out front and leading Truex until the final lap when Hamlin finally jumped out of line to make his attempt at the win. Starting a second line on the outside, Hamlin got a push from Kevin Harvick that allowed him to catch Kenseth. Kenseth tried to throw a block but Hamlin wedged into the middle between Kenseth and Truex and Kenseth had to save his car from wrecking.

"The last thing I wanted to do was wreck off turn four with my Toyota teammates and none of us win," Hamlin said. "We had talked about a plan overnight to just work together, work together and I've never seen it executed so flawlessly.

"I said with two to go that we have to get the team victory no matter what it takes and I essentially was trying to go up there and block (Harvick) to keep him from getting to those guys."

But the push from Harvick was so strong, Hamlin was able to catch Kenseth and Truex. Once Kenseth was out of the way, Hamlin raced Truex side-by-side to the checkered flag for a photo finish. The margin of victory was 0.010 seconds, the closest in race history.

"I don't know where that came from, I don't know what happened, I can't even figure out what I did," Hamlin said. "It all just came together. But this wouldn't be possible if it wasn't for Toyotas sticking together all race long."

It was Hamlin's first Daytona 500 victory and first for Toyota. Gibbs, who in November celebrated with Busch the team's first Sprint Cup title in a decade, won the Daytona 500 for the first time since Dale Jarrett in 1993.

Truex, who spun the loss as a positive in that he proved to JGR that he and Furniture Row Racing will be strong partners, wasn't sure what he could have done differently.

"It hurts a little bit," Truex said. "We were in the right spot, we made the right moves. You can second-guess all day long, the only thing I could have done different was be more aggressive to the line."

Toyotas swept the podium as Truex was second, and Busch third. Carl Edwards was fifth as Toyota took four of the top five spots.

"Great day for Joe Gibbs Racing, really pumped for Joe to get back to victory lane here in the Daytona 500," said Busch. "I figured it was five to go that it was every man for himself. Once Denny jumped up, he just got such a huge boost from (Harvick). Once he did it, I swore I thought about doing it. Once I thought about doing it and didn't do it, it was too late. That was it. You can't think that long and not make the move at the same time."

Kenseth faded to 14th.

"They don't get much more crushing than that," Kenseth said.

Dale Earnhardt Jr., seeking his third Daytona 500 victory, came up empty as he tried to force his way through the field late in the race.

Earnhardt was using the high line to inch closer to the front, and when he tried to get a side draft from another car, he spun through the fourth turn. His Chevrolet hit an interior wall and then ricocheted into the grass, where Earnhardt found himself stuck.

Earnhardt was a heavy favorite to win and brought a car nicknamed "Amelia Earhart" that had appeared to be unbeatable. Amelia won four races — including a qualifier at Daytona earlier this week — and never finished lower than third in seven starts over the past year.

Copyright 2016 NPR. To see more, visit http://www.npr.org/.