Daytona Beach, FL (SportsNetwork.com) - Matt Kenseth won the first Budweiser Duel in a photo finish, while his Joe Gibbs Racing teammate, Denny Hamlin, claimed the victory amid a wild last-lap crash in Thursday night's second qualifier for the Daytona 500.

The first Duel at Daytona International Speedway ran caution free, and the second event had been without an incident until a nine-car wreck occurred on the final turn of the last lap. Clint Bowyer rolled on top of David Ragan's car and did a 360-degree roll in the air before it landed upright.

"I felt somebody hit me and I was like, "Oh boy!" Bowyer said. "It's an eerie silence right there, and you're always wondering what's going to happen. You're more nervous about what's going to happen when it lands."

Jimmie Johnson, who won his second Daytona 500 and sixth Sprint Cup Series championship last year, triggered the pileup when he ran out of gas, causing Jamie McMurray to bump into the back of him. Johnson slammed into the outside wall and then came down the track before he collided into McMurray again on the infield grass. The front end of his No. 48 Hendrick Motorsports Chevrolet briefly erupted into flames. There were no injuries.

"I feel terrible about tearing up that many race cars and seeing the 15 [Bowyer] flip," Johnson said. "I certainly want to apologize to everyone. I tried to get up out of the way and had my hand out the side, but on the last lap coming to the checkered, there's so much going on. There was so much energy in the pack that I knew I was going to get run over if I ran out of fuel. Thankfully, everybody is alright."

Johnson qualified 32nd for Sunday's Daytona 500.

Others involved in the crash were: Martin Truex Jr., who had already secured the second starting spot for the Daytona 500 in last Sunday's time trials, Carl Edwards, Justin Allgaier and Michael Waltrip, who is also Bowyer's team owner. Waltrip's car smashed into wall along the entrance to pit road.

Hamlin's win in the second Duel came five days after his victory in The Sprint Unlimited preseason race at Daytona. He also concluded the 2013 Sprint Cup season with a win at Homestead.

"We're on a roll," Hamlin said. "We executed the race great. Didn't execute the first part of the race that well, trying to make moves, trying not to run single file. I kind of wanted to spice things up a little bit. It ended up taking me to the rear for the most part. But fought our way back."

Kenseth and Hamlin placed their JGR Toyotas on the second row for the Daytona 500. However, Kenseth and Hamlin will move up to the second and third starting positions, respectively, since Truex will have to start from the rear of the field in a backup car.

"It stinks for my guys [No. 78 Furniture Row Racing team] who worked so hard and gave me a great race car," Truex said. "For somebody to run out of gas on the last corner of the last lap, you never really think that can happen. It is what it is. We'll get our backup car out. It doesn't matter where you start this race anyway."

Kenseth, a two-time Daytona 500 winner, nipped Kevin Harvick to the finish line by only 0.022 seconds, while Kasey Kahne crossed the line just 0.063 seconds behind. Kenseth led 31 of 60 laps. He won the Duel and the Daytona 500 two years ago.

Harvick grabbed the lead from Kenseth as they came out of the last turn on the final lap, but Kenseth quickly moved to the outside of him and then pulled ahead for good.

"At the end, I saw Kevin making that move," Kenseth said. "You weren't going to be able to block it without wrecking. I just tried to get back to him, and thankfully, I had enough time to get that run to the finish line."

Harvick's No. 4 Stewart-Haas Racing Chevrolet failed post-race inspection and therefore his time was disallowed in the event, dropping him to a last-place finish in the 24-car field. His car exceeded the maximum split on track bar. He will start 38th in the Daytona 500, based on his third-place finish in last year's car owner points.

It had been a tough week for Kenseth at Daytona prior to his Duel win.

In last Saturday's Sprint Unlimited, Kenseth caused a big wreck when he spun after Joey Logano bumped him from behind. Nine of the 18 drivers in that race were involved in the crash. During Wednesday's practice, Kenseth and Logano made contact again, which started a frightening seven-car crash on the frontstretch. Parker Kligerman's car plowed into the SAFER barrier and catchfence before it rolled over onto its roof and slid down the track.

"Walking in the garage, honestly, like today [Thursday], I was kind of embarrassed to walk in the garage," Kenseth admitted. "They're probably not, maybe some of them are, but I feel like they're looking at you cross-eyed when you're walking by."

The rash of multi-car wrecks at Daytona within the past week prompted many drivers to race cautiously in the Duel.

"I think we've all done a pretty good job at tearing a few things up along the way so far," Harvick said. "I think everybody was a little bit conservative. There was only 18 cars in the Unlimited, and we tore the whole field up. Everybody wanted to do what they had to do to get the best finish that they could. Those of us running up front tried to win the race. It just didn't time out exactly perfect."

Rookies Cole Whitt and Alex Bowman earned a spot in the Daytona 500 after finishing among the top-15 in the first Duel. Both drivers had to race their way into the 500. Whitt wrecked his No. 26 Swan Racing Toyota in practice, just prior to his teammate Kligerman, also a rookie, having his crash.

"We weren't ready to give up," Whitt said. "We knew coming down here, it was already hard for us to even get down here, let alone the things that happened to our team [Wednesday], not just our car, from Swan Racing losing two cars."

Kligerman finished 17th in the opening Duel and had to wait until the outcome of the final event to find out if he had qualified for the Daytona 500. He earned the 41st starting spot one day after his horrifying wreck.

"Pretty big change, eh?" Kligerman said. "We'll start there. Obviously that was a letdown [Wednesday]. One of the most interesting moments of my life, sliding on your roof."

Notable drivers and their starting positions for the Daytona 500 include: Jeff Gordon (6th) Dale Earnhardt Jr. (9th), Tony Stewart (21st), Danica Patrick (27th), Edwards (30th), Brad Keselowski (33rd), Logano (35th), Kyle Busch (37th) and Waltrip (42nd). Ragan claimed the final starting spot.

Keselowski led the most laps in the second Duel with 34 but received a penalty for speeding on pit road and then suffered a flat tire, requiring him to pit again and therefore put him three laps behind. He finished 24th.

Ryan Truex, Michael McDowell, Joe Nemechek, Morgan Shepherd and Eric McClure failed to qualify.

Earlier in the day, Dave Blaney withdrew from the Daytona 500. Blaney was one of the seven drivers involved in Wednesday's practice crash. His Randy Humphrey Racing team did not have a backup car and could not obtain one to compete in the first Duel.