It won't work out of the box.
After installing the drive, you need to boot into Recovery (hold down Cmd+R during boot, it's a partition that's hard-wired into the logic board), and reinstall OS X from there after using Disk Utility (there's a few apps in Recovery, DU is one of them) to format the drive.
Honestly, I don't know why you didn't get an SSD instead. It would have made a world of difference.