"I bought bread at the grocery store."
Translation:Compré pan en el supermercado.
It can (as well as in, to, on, by, etc...) . Prepositions are tricky little buggers. Their use in one language doesn't always translate directly to one particular preposition in another language. My advice is to try to associate their use with particular verbs or particular phrases. This is not foolproof and certainly not easy to do.