Yes provided you first logged in from your old PC and basically got your windows copy registered with your microsoft account. It's why when you go to your microsoft account they have a dedicated section called migrating to new PC or something like that.
If you have not done this prior to hdd dying, no problem. The copy of windows is actually linked to the motherboard. So...you could install windows on your new hdd plugged into your old system. It would get automatically authenticated. Then log into microsoft account, link it. Then wipe the drive, put it inside your new computer and repeat the process, except you delay authentication until you're in windows and then you connect to microsoft account.