Apple Macbook Pro backup question

If I use Time Machine to backup all the data...for all users, and the settings on my MacBook pro,  my understanding is that I would be able to recover that information in the event I needed to restore that information.  However, if the computer hard drive fails to function and I have to replace the hard drive (the operating system at this time is Yosemite 10.10.2) I am assuming that I would replace the hard drive with a new hard drive.  How do I replace the operating system as I do not have any disc for the OS called Yosemite?  Do I just go to the Apple Store and download Yosemite and install it?  I am assuming that my Apple ID would make this possible but I am not sure.  Also, one related it possible to do a system image of the hard drive with Time Machine?  My impression is that Time Machine is good at backing up data but the folks who talk about Time Machine do not promote doing a system image with that software.
Richard ChristensenRetired computer technicianAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

It depends on how badly the HD fails. If it is simply badly corrupted you can restart into the Recovery Partition by booting while holding down Command-r, then erase and reformat the main partition and recover your data and operating system using Time Machine.

If the hard drive has a mechanical failure so that the recovery partition is not available, then you may have re-install using Internet Recovery:

However it is a good idea to have an external bootable drive available for emergencies and you can make a bootable clone of your drive using the built-in Disk Utility following these instructions:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gerwin Jansen, EE MVETopic Advisor Commented:
You can re-install OSX from internet:
(or from Time Machine as the initial backup is the complete system).
Richard ChristensenRetired computer technicianAuthor Commented:
Thanks for your advice.  Much appreciated.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apple OS

From novice to tech pro — start learning today.