Chris Seddon (1-1) pitched a scoreless 12th for the win, Cleveland's seventh in 17 meetings with Chicago. It was the left-hander's first victory since July 24, 2010, when he was with Seattle.
Hafner tied it with his 200th homer for Cleveland and 201st of his career. He is scheduled to play in Wednesday's season finale, which could be his last game in a Cleveland uniform. The Indians almost assuredly will not pick up his $13 million option.
"I'm happy to win it, but how about Hafner?," Donald said. "You almost wouldn't expect anything else. Whether it was his last homer here or not, it was so cool."
Viciedo connected for a 426-foot shot to center for his 24th homer — and fifth against the Indians this season. Viciedo is hitting .346 with 18 RBIs against Cleveland.
Orlando Hudson singled for his third hit before Viciedo delivered.
After Perez gave up Viciedo's homer, he allowed a one-out single to Jordan Danks and then hit Tyler Flowers in the left hand with a pitch. Flowers glared out at Perez and both benches were warned. After Perez retired the side, he and Flowers met at the side of the mound.
Chicago scored in the sixth off Indians starter Justin Masterson. Dewayne Wise hit a one-out double and scored on Orlando Hudson's line single.
NOTES: Chicago 1B Paul Konerko will have surgery on his left wrist Thursday. Ventura said Konerko might play in the season finale on Wednesday. ... Sox 1B/DH Adam Dunn struck out twice and has fanned 222 times, one shy of the major league record set by Mark Reynolds with Arizona in 2009. ... Before the game, Perez said while he respects Manny Acta, he had a problem with the fired manager not confronting umpires.