Macy’s posted a surprise third-quarter profit and its strongest comparable sales in more than three years as an extensive overhaul of the 167-year-old New York department store begins…