Hafner pinch-hit HR in 8th, Yankees beat Arizona