With seven laps remaining in regulation, Hamlin appeared to be headed to his fifth victory of the season and first at the Brickyard. But he went careening into the first turn wall when a tire blew out, pushing his No. 11 Joe Gibbs Racing Toyota out of the lead. He was unable to finish the race.
Harvick then beat Kenseth off the final restart in overtime to seal the victory. It was his 53rd career win, as he moved within one of tying Lee Petty for 11th on NASCAR's all-time list.
"We knew he was really close on tires so [crew chief] Rodney [Childers] said on the radio to keep the pressure on him," Harvick said. "It's the Brickyard. This is what I grew up wanting to do, so to come here and win for the third time is something I couldn't have dreamed up."
Prior to Sunday's Big Machine Hand Sanitizer 400 in Indianapolis, seven-time Cup Series champion Jimmie Johnson was forced to withdraw after revealing a positive coronavirus test Friday. He became the first driver in any NASCAR series to test positive.
Hendrick Motorsports said Johnson won't return until a physician clears him.
"My first priority is the health and safety of my loved ones and my teammates," Johnson said in a statement Friday. "I've never missed a race in my Cup career, but I know it's going to be very hard to watch from the sidelines when I'm supposed to be out there competing.
"Although this situation is extremely disappointing, I'm going to come back ready to win races and put ourselves in playoff contention."
Johnson, 44, is set to retire from full-time NASCAR competition at the end of this season. Before Sunday's race, he had made 663 consecutive Cup Series starts -- the longest streak among active drivers. He is a four-time Brickyard 400 winner.
Justin Allgaier made his first Cup Series start since 2016 as a late replacement for Johnson and drove his No. 48 Chevrolet. He finished 37th after being involved in a six-car pileup near the entrance of pit road, which also resulted in Ryan Blaney's tire changer, Zachary Price, being transported to a hospital after getting pinned.
"Once the wreck started happening in front of us and we all got bottled up there, one car after another was getting run into," Allgaier said. "Just a shame. I hate it for these guys on this Ally 48. They've done such a good job and they prepared so well for the circumstances.
"Obviously our hearts and our thoughts are with Jimmie right now and his family. That's the most important piece of all this, getting him back to the racetrack soon."
Kenseth came in second place, marking his first top-5 finish since 2017. Aric Almirola finished third, followed by Brad Keselowski in fourth and rookie Cole Custer in fifth.
The NASCAR Cup Series' next race is scheduled for Sunday at Kentucky Speedway.