When you buy an Apple product from an authorized retailer, such as Best Buy, you receive a 1 year warranty from Apple (you can buy an extended warranty through Apple or Best Buy.) Apple calls their warranty "Applecare". When you connect your computer online you will be asked to register it with Apple, at which time, your computer, and its warranty, are now in Apple's system.
If during your warranty period, you have an issue with your mac, you should first go to the Apple website and go through their chat or phone procedure. If they agree there is an issue, they will most likely make an appointment at the nearest Apple store for you to have your problem fixed by a genius. They don't care where you purchased it once it is in the warranty system, they just want to fix your computer for the least cost to them, which is most likely you bringing the product into the store.
Good luck with the purchase!