DAYTONA BEACH, Fla. -- When he was in second grade, Denny Hamlin wrote a letter to himself wishing for a Daytona 500 victory.
His childlike cursive stated he wanted to win the race in 1998. Hamlin had to wait considerably longer, just not as long as team owner Joe Gibbs.
With a Hail Mary move Sunday, Hamlin ended Gibbs' 23-year drought at the Daytona 500. It gave Hamlin his first Daytona 500 victory in 10 tries, and Toyota its first in "The Great American Race."
"You couldn't have written a better ending," Hamlin said. "It's the pinnacle of my career, for sure."
Hamlin pulled out of line with a lap to go and chased down teammate Matt Kenseth. He staved off Kenseth's block, and wedged between Kenseth and Martin Truex Jr.
Hamlin stayed in the gas for a door-to-door dash to the checkered flag that ended in a photo finish with Truex. He beat Truex by 0.010 seconds, the closest finish in the history of the race.
"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."
Gibbs, who in November celebrated with Kyle Busch the team's first Sprint Cup title in a decade, won the race for the first time since Dale Jarrett in 1993.
Gibbs had made it clear that he had no use for the victories his drivers collected in the exhibition races leading into Sunday's season-opener - Hamlin and Busch each won one race in the buildup to the opener. But the three-time Super Bowl-winning coach was focused only on the 500 and his four drivers brainstormed on the best way to get a win.
"The thrill in football, you can't get any more excited than that, winning a Super Bowl. It's the same thrill over here," Gibbs said. "Most people never get to have a dream in life. I've had two from an occupational standpoint. I'm probably one of the most blessed guys in the world."
Hamlin, Kenseth, Busch and Carl Edwards stuck close together for most of the race, and they got assistance from Truex, who became a de facto JGR teammate this year when Furniture Row Racing moved to Toyota.
Kenseth led Truex until the final lap when Hamlin finally jumped out of line. 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 race for the win.
Truex wasn't sure what he could have done differently.
"It hurts a little bit," Truex said. "I think the only thing I should have done different was been a little more aggressive coming to the line, holding Denny up the race track. That last split second when he pulled off my door, that was it. It gave him that couple inches to beat me to the line.
"It's hard to make those decisions. Live and learn. I think if I get in that position again, I'll do it a little bit differently."
Toyotas swept the podium as Truex was second, and Busch third. Edwards was fifth as Toyota took four of the top five spots. It comes three months after Busch gave Toyota its first championship.
"This was our 10th try at the Daytona 500," said David Wilson, president of Toyota Racing Development, who called the win the biggest in Toyota history - trumping even the 2003 Indianapolis 500 victory.
"When we came into the sport, we struggled. We were not ready. We didn't know. And so it's taken time for us to collectively build an organization of winning races and competing for championships."
Kenseth faded to 14th.
"They don't get much more crushing than that," Kenseth said. "If I can't win, I want my teammate to win. There's a million things you could do differently, but I did what I thought I should do at the time to try to win. We finished terrible, but that was the move I thought I had to make to try to preserve the win."
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.
"Caught me by surprise there," Earnhardt said. "We were making some ground on the leaders a little bit so that was looking pretty good because the outside line really hadn't been doing anything all day. Just busted my butt there. Driver mistake."