You can say Buenos días, 'Good day/morning', until lunchtime, which can be as late as 2pm, Buenas tardes, 'Good afternoon/evening', after lunch until sunset, and then Buenas noches for 'Good night'.
To ask 'How are you?', you have two options. If it's someone you know well or younger than you, it's ¿Cómo estás?. For someone you don't know or older than you, it's ¿Cómo está?.