Wawrinka, seeded third, won 6-7 (1-7) 6-4 7-5 6-3 to add the US title to those he had already won in Australia and France over the last two years. The 31-year-old hit 46 winners in a brilliant display of shot-making.
Serbia's Djokovic made a strong start but struggled physically as the final entered a fourth hour in New York.
Wawrinka has now won all three Grand Slam finals he has played and his last 11 finals in a row, while on Sunday he became the oldest winner of the US Open since 35-year-old Ken Rosewall in 1970.
Congrats to him!