The Bucks had a nine-point lead going into the fourth period, but Cleveland moved in front for good with 6:31 to play on a 3-pointer by Wayne Ellington.
Irving hit a jumper with 31 seconds to play that gave the Cavaliers a five-point cushion and he added four free throws the rest of the way to protect the lead.
Cleveland has won two in a row for only the second time this season and produced just its second victory over a division opponent in 11 tries.
Tristan Thompson added 18 points for Cleveland and Dion Waiters chipped in 16.
Milwaukee, which had won its previous three games, was led by 30 points and seven rebounds from Ersan Ilyasova.