American JJ Spaun beats Robert MacIntyre by two shots to win his first major title on a chaotic final day at the US Open.