Install Mac OSX on a new replacement hard drive
You need a USB stick with an OSX Installer loaded onto it.

Before you remove the old hard drive you need to prepare the USB stick so you can install it on the new drive.

Check out the Apple walk-through here.

After installing the OS you can restore your old files from a time machine backup.

The restore partition on the old hard drive could work but you need an enclosure or sled to connect the old drive externally.

Good luck!