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.
Notable deaths of 2014 [PHOTOS]
Michael Sam cut from the Dallas Cowboys