High-school student Kosuke Hagino set a new national record as he clinched his place in the London Olympics at Japan's swimming championships on Monday.
The promising 17-year-old won the men's 400m individual medley in four minutes 10.26 seconds, pipping world bronze medallist Yuya Horihata into second in 4:10.52.
Horihata, who was also faster than the previous national record, also qualifies for the Olympics.
"It was tough at the last moment, but I did my very best because I knew Horihata would come to catch up with me," said Hagino.
Horihata said: "I was beaten, but I'm glad that I qualified. I won the bronze medal at the world championships competing as a challenger. I will challenge again in London and try to get a better result."
Miyu Otsuka and Miho Takahashi claimed their tickets to London by finishing one-two in the women's 400m individual medley in 4:36.64 and 4:37.71.
"I was confident that I would not be beaten in the last freestyle, but I must swim under 35.00 (4:35.00) to compete against the top swimmers in the world. I'm going to power up," said Otsuka.
A relieved Takahashi said: "I was disappointed that I couldn't swim in the time I wanted. But I'm happy, because it's been my dream to go to the Olympics."
Fumiya Hidaka won the men's 400m freestyle in 3:48.21, while Asami Chida took the women's 400m freestyle in 4:10.72, but both were slower than the qualifying time.
Two-time double Olympic champion Kosuke Kitajima, who marked the best times in the heats and semi-finals, will make his appearance in the men's 100m breaststroke final on Tuesday.