Many Spanish greetings(Saludos) depend on the time of day.
Buenos dias – Good morning
Note that even though Buenos dias includes the word dia, it’s only used in the morning.
Buenas tardes – Good afternoon / Good evening
You can use Buenas tardes in the afternoon or in the early evening.
Buenas noches – Good evening / Good night
Buenas noches can mean both Good evening and Good night.