Thiago Pereira of Brazil took the silver and Kosuke Hagino of Japan won the bronze.
American Michael Phelps finished fourth, ending his streak of Olympic success that had seen him win a record eight gold medals in Beijing four years ago.
The medal for Lochte was the first gold captured by the United States in these Olympics.
Jordana Brewster on Paul Walker: 'He was an enormous presence in my life'
Beyonce flaunts bikini body, Blue Ivy in vacation pics