Ryan Lochte thrashed American compatriot and double Olympic champion Michael Phelps to take 400m individual medley gold.

Phelps, the greatest all-round swimmer his sport has seen and gold medallist in both Athens and Beijing, was left without even a bronze as Brazil's Thiago Pereira took second and Japan's Kosuke Hagino third.

But this was all about Lochte, the brash rising star, seizing ascendancy in buccaneering fashion.

"I'm in shock right now, but I knew I could win so I'm happy I could do that," said Lochte. "I heard the fans throughout and having them and my family right there really helped."

Referring to Phelps, he said: "I know he gave everything he had, so I'll have to have a chat with him and see how he is after that."

Adrian Moorhouse Olympic gold medallist and BBC pundit "That was a fantastic race. Lochte went for it from the beginning and dominated all the strokes. To have Lochte take 0.2secs off Phelps on the butterfly meant it was only going to go one way on the backstroke."

A disappointed Phelps said: "I felt great for the first 200m, but after that it just didn't happen. I had the chance to get off on a good note but didn't do it."

His coach, Bob Bowman, added: "He trained really well coming in here. I'm surprised. We just have to put it behind us and move on."

At the US trials this summer, Lochte had won his duel with Phelps by less than a second. In London, his four minutes 05.18 seconds put him almost four seconds clear of his rival, who clocked 4:09.28.

Lochte went off hard and turned off the butterfly leg, supposedly Phelps's strongest, 0.2 seconds in front. That advantage became 2.55 seconds after the backstroke as Hagino came past the struggling champion.

Phelps was isolated out in lane eight after only scraping into the final as last qualifier from the morning's heats and could make no impression as Lochte turned at 300m with Pereira two bodylengths adrift in second and Hagino in third.

With 50m to go, Lochte was inside Phelps's own world-record pace as he closed on gold. A new record proved beyond him, but Lochte added the Olympic title to his World Championship crown as the American contingent roared him home.

Phelps had been marginally second favourite going into the first round of the pair's eagerly anticipated duel.

But his display left him stunned and raises questions about his form in his other events as he seeks to add to his record-breaking 14 Olympic golds.