"¡Buenos días!" is a great greeting to use--before noon!
Remember to switch to "¡Buenas tardes!" after noon.
Just as in English, the use of "¡Buenas noches!" can vary--some people would use it late in the day (for example, when leaving work and you know you won't see the person again until the next day). Others might find that use odd because they only use it at bedtime.