The Cavaliers overcame a nine-point deficit in the final minute of the fourth quarter and then limited the Magic to two overtime points while snapping a six-game losing streak.
Varejao scored 18 points and equaled a franchise record with 25 rebounds. He put the Cavaliers in front for good with 2:02 left in overtime by hitting a jump shot and then converted another field goal and two free throws down the stretch.
Orlando did not score during the final 63 seconds of regulation while the Cavaliers were staging their improbable comeback. Cleveland was helped along when Orlando's E'Twaun Moore missed two free throws with nine seconds left that could have clinched the victory.
Instead, Orlando's lead remained at two points and Dion Waiters forced the extra period when he made a layup with a second left.
Waiters scored 17 points while Tristan Thompson had 16 points and 10 rebounds for the Cavaliers. Orlando was led by Glen Davis with 16 points.
UPI horse racing weekend preview
Bo Jackson: I can't help Jameis Winston anymore