Nobody was watching Ahmed Hafnaoui in lane eight of the Olympic pool.

All eyes were on the Tunisian teenager at the finish.

Hafnaoui was the stunning winner of the 400-meter freestyle at the Tokyo Games on Sunday, beating a field of faster and older swimmers. The 18-year-old finished in 3 minutes, 43.26 seconds, punctuating his victory with loud yelling that echoed in the mostly empty 15,000-seat arena.

"I believe when I touched the wall and I saw myself first," he said. "I was so surprised."

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

Australia’s Jack McLoughlin earned silver and American Kieran Smith took bronze. The top three were separated by less than a second after the eight-lap race.

"When I hit the water, I was just thinking about the medal, not the time," Hafnaoui said.

He squeaked into the final by 14-hundredths of a second, landing him in the far outside lane. The fastest qualifiers were in the middle of the pool, without the ability to track Hafnaoui during the race.

Asked what he knew about Hafnaoui, Smith said, "Absolutely nothing."

Hafnaoui made sure he'll be remembered with a performance that boosted his resume considerably.

He joined Ous Mellouli as the only Tunisians to win a gold in swimming. Mellouli won the 1,500 freestyle at the 2008 Beijing Games, one of his three career Olympic medals. He reached out with a good-luck message to the teenager before the race.

"I wish to be like him one day," Hafnaoui said.

The teen who trains in the capital of Tunis is the North Africa country’s fourth Olympic gold medalist. He’s the second-youngest athlete from an African nation to win a swimming gold; Joan Harrison of South Africa was 16 when she won the 100 backstroke at the 1952 Helsinki Games.

Standing on the podium, his coach furiously pumping his arms in triumph in the stands, the moment was overwhelming for Hafnaoui.

"I was in tears because when I see the flag of my country and I hear the anthem in the background, it was great," he said. "I’m so proud of it. I dedicate it to all the Tunisian people."

Hafnaoui began swimming at age 6 when his father enrolled him in a swim club. His limited international experience includes an eighth-place finish in the 400 free at the 2018 Youth Olympics.

"The best people are the ones who can come up and swim their best times at the Olympic Games," McLoughlin said.

Hafnaoui has another chance to pull off a surprise when he competes in the 800 free on Thursday. Next year, he said he plans to attend college in the U.S.