To start with, you can say simply 'Hola' or 'Buenos días/Buenas tardes/Buenas noches' to unknown people. I guess you already knew these.
Once you know the person, a plain greeting could be 'Qué hay' or 'Qué pasa' (something like 'what's up?').
Many young people simply say '¡Eeeeeyyyy!' when they meet at bars or the like, you know, often shaking hands.
Of course, you can still use 'Hola', it doesn't sound too formal at all (pronunciation is not so strict, so can enlarge vowels at will: 'Hoolaaaaaaaa').
If you haven't seen the person for a long time, you can ask something like '¿Cómo te va?' (something like 'how have you been?').
Also, when speaking to friends, many people add words like 'tío' ('dude') or 'colega' ('mate').
When people are too happy to see their friends (and if there is real confidence), sometimes they use slang words like 'Hijoputa' (literally, 'son of a bitch'). This can be confusing, and usually not recommended, but if you listen to Spanish people talking between them, surely you'll hear this. Rules to apply this kind of vocabulary are complex, so better don't use it if you are not sure with recently known people.
Examples:
'¡Qué pasaaa, tío! ¿Qué hay?' - 'What's up, duuuude! What's the matter?'
'Hoooolaaaa, qué tal todoo?' - 'Heloooo! How's everything?'
'Eeeeeeey, colegaaa' - 'Eeeeeeeey, duude'
(surelly you'll hear this, but be careful):
'¡Hiiijopuuuta, cuánto tiempo!' - 'Damn it! So much time!'