Aaron Peirsol, left, Eric Shanteau, centre, and Michael Phelps of the American relay team celebrate after their record-shattering victory in the men's 4x100m medley final on Sunday. ((Martin Bureau/AFP/Getty Images))

Michael Phelps put an exclamation mark on the final race of the 2009 World Aquatics Championships, winning his fifth gold medal as the U.S. team shattered its own world record on the way to winning the men's 400-metre medley relay on Sunday in Rome.

Phelps swam the butterfly leg of the race, and steadily pulled away from German Benjamin Starke to give anchor David Walters a healthy lead to take to the finish.

"That relay brings out the best in me," Phelps said. "It doesn't matter how much energy I have; it's all going to go into every race. That's one of the things that I enjoy most — stepping out onto the blocks no matter what kind of shape I'm in."

The U.S. team won in 3:27.28, more than two seconds better than the world mark they set in Beijing.

Germany and Australia, who were right with the Americans until Phelps hit the water, finished second and third. The Germans clocked in at 3:28.58 and the Aussies finished in 3:28.64.

In total, four teams bettered the world record pace set by the U.S. back at the 2008 Olympics. The mark brought the final tally of world marks set at the aquatics championships to 43, by far a record itself.

A couple of those records were set earlier in the day.

Liam Tancock got the night program started with a record-setting victory in the men's 50-metre backstroke. The Briton finished in 24.04, bettering his own mark set a day earlier by four hundredths of a second.

Japan's Junya Koga was second and South African Gerhard Zandberg was third.

German Britta Steffen set her own world mark in the women's 50-metre freestyle, touching the wall at 23.73. Therese Alshammar of Sweden was second, while Australian Cate Campbell and Magdalena Veldhuis of The Netherlands finished in a tie for third.

The Americans finished one-two in the men's 400-metre individual medley, but Phelps wasn't one of them. He instead rested for the relay, paving the way for Ryan Lochte to take gold and Scott Tyler Clary to win silver.

"It definitely felt good to get these wins after coming second to Michael for so long," said Lochte. "But I wish he was here swimming just because he's a great competitor, and I love racing him. I'm trying to talk him into doing the IM again."

Lochte broke Phelps's world record in the 200-metre individual medley last Thursday but couldn't best his rival's mark in the 400. Lochte finished in 4:07.01, well off the mark Phelps set in Beijing (4:03.84). Laszlo Cseh from Hungary finished third.

With files from The Associated Press