In Spanish speaking countries people greet each other in similar situations as in English speaking countries. You have to have in mind that there's a difference when talking to the elderly or to younger people. Notwithstanding the previous observation, the greeting hola is used both, formally and informally.
For example, to ask -how are you?- you say: ¿cómo está usted? when talking with more respect, or ¿cómo estás? when talking less formally. So, you would say: hola, ¿cómo está? when talking formally, or hola, ¿cómo estás? when greeting informally.