Lochte added the Olympic gold medal to the world title he won in Shanghai last year when he cruised to a surprisingly lopsided victory in four minutes 05.18 seconds.
Brazil's Thiago Pereira won the silver medal after finishing second in 4:08.86 while Japanese teenager Kosuke Hagino collected the bronze for finishing third in 4:08.94.
"I feel amazing, knowing that for the last four years I have put in all that hard work," Lochte reflected. "When I touched the wall, I guess I was in shock. I guess I still am.
"I have said this before, that this is my year. I know and I feel it, just because I have put in the hard work.
"I trained my butt off for four years, I just feel it inside my gut that this is my year."
Phelps, who won the gruelling event at the past two Olympics, faded to finish fourth in 4:09.28, more than five seconds outside his world record.
The race, a lung-bursting test to decide the world's best all-round swimmer, was billed as one of the great rivalries of the London Games but failed to live up to all expectations as Lochte stormed away to win easily.
Phelps was swimming in the outside lane after just scraping into the final as the slowest qualifier and was never a threat.
The last time Phelps, who won eight gold medals in Beijing four years ago, was beaten in an Olympic final was when he came third behind Ian Thorpe and Pieter van den Hoogenband in the 200 freestyle at Athens, which was dubbed the "race of the century."
He has entered seven events in London and needs to win three medals to break the all-time record of 18 held by Soviet gymnast Larisa Latynina.
For Lochte, it was his fourth gold medal and the first of what is expected to be several more in London.
Lochte said he still thought he might have gone out too fast in the first two laps.
"I think I went a little bit too hard in the first 50 of the 'fly," he said. "I was in the lead, I kept on looking at the scoreboard, I guess that slowed me down. I knew it wasn't just me and Michael, there were other swimmers there."
"I felt fine for the first 200 metres. They just swam a better race than me," said Phelps, who must lift himself for his six remaining races before he retires.
"They were better prepared, it was a frustrating race for me. I was lucky to get into the final."
Lochte was generous in his praise of Phelps, who he said would be a real challenge in the shorter medley race.
"Michael to me is one of the world's greatest, no matter what happens he will be remembered as one of the greatest," he said. "I know he gave it 110 per cent."
Sun Yang came within a whisker of breaking the world record to win the men's 400 metres freestyle final at the London Aquatics Centre on Saturday and became the first Chinese man to win an Olympic swimming title.
The 20-year-old sprinted clear of his rivals on the final 100 metres to win the gold in three minutes 40.14 seconds, just 0.07 outside the world record of 3:40.07, set by Germany's Paul Biedermann at the 2009 world championships in Rome during the height of the bodysuit controversy.
South Korea's Park Tae-hwan, who won the event in Beijing four years ago, finished second after winning an appeal just to compete in the final.
He led for the first 300 metres under world record pace and held on for second in 3:42.06. American Peter Vanderkaay was third in 3:44.69.
The 22-year-old Park easily won his morning heat only to be told he had been disqualified for a false start but the Korean Swimming Federation protested to the sport's world governing body and succeeded in getting the decision overturned.
Sun also holds the world record for the 1500 freestyle, the longest event in the pool, which he set at last year's world championships in Shanghai and is an overwhelming favourite to win the gold in London.
Biedermann failed to qualify for the final after finishing 13th overall in the heats.
Sun becomes the first ever Chinese man to win an Olympic swimming gold medal.
- Related links