Australia retain Ashes with tense Test win