The United States won the mixed 4x100m relay in Budapest, edging Jamaica for gold with a personal-best time of 39.64 seconds.