The Jazz were clinging to a 3-point lead with just over 2 minutes remaining when Williams picked off a James Harden pass and cruised in on a breakaway for a slam dunk.
Then, after each team had posted a basket, Williams drained a 3-pointer off an assist from Gordon Hayward to secure the victory.
Hayward pumped in 29 points while Trey Burke and Alec Burks each provided 21 for Utah, which won a second straight game for the first time this season.
Williams finished with 10 points.
Harden paced the Rockets with 37 points and eight assists.