(CNN) -- A dramatic fightback from Ryan Lochte secured a thrilling victory over Olympic champion Michael Phelps in the men's 200m freestyle at the World Championships in Shanghai.
Lochte trailed fellow American Phelps at the halfway stage but battled back to win in a time of one minute, 44.44 seconds compared to his rival's 1:44.79.
Defending champion Paul Biedermann, from Germany, claimed the bronze medal in a strong field.
It was Lochte's eighth gold at the World Championships but his first at the 200m distance, and handed him a major boost with only a year to go until the 2012 Olympics in London.
"Michael and I have been battling head to head for about eight years," Lochte told FINA's official web site after his victory. "We definitely build a good rivalry; he's a great competitor and I am just privileged to swim on the same team, even in the same event as him.
"Today, at this level we're at, we both want to win, we don't like to lose and no matter what the outcome is, we're still going to be friends and we're definitely going to be pushing each other for 2012."
Phelps emphasized the quality of the competition and said he is starting to recapture the form that has seen him bag 16 Olympic gold medals to date.
"That was probably one of the best 200 freestyle fields and that was a close field; five guys in the 1.45, that's pretty good," he told FINA's web site. "I would have wanted to win but this is something that is going to help me a lot for the next year."
He also said a lack of training has contributed to a dip in his performances. "The reason why I haven't been able to swim as fast as I wanted to in the last couple of years, it's all my fault.
"If I would have trained like I was supposed to for as long as I am supposed to, on a consistent level, I would be swimming where I want to swim. But now, I am sort of coming back to my old self."
There was an even closer finish in the men's 100m backstroke, when French pair Camille Lacourt and Jeremy Stravius shared the gold medal after both recorded a time of 52.76.
It is the first time ever two swimmers from the same country have tied in a dead heat for first place. It was also France's first ever male title in the championships.
Elsewhere, China's Zhao Jing won a gripping women's 100m backstroke final, beating Russia's Anastasia Zueva by just one one-hundredth of a second. American Natalie Coughlin took the bronze medal.
Rebecca Soni, from the United States, successfully defended her women's 100m breaststroke title, beating Australian Olympic champion Leisel Jones and China's Ji Liping who took silver and bronze.
A dominant performance from Denmark's Lotte Friis secured the women's 1,500 freestyle final. American Kate Ziegler took silver and China's Xuanxu Li the bronze.