An interjection expressing disbelief or strong denial — 'No way!' or 'You don't say!'
まさか!彼がそんなことをするはずがない。
No way! He would never do such a thing.
まさか、冗談でしょう?
No way — that's a joke, right?
Adverb used (often with a following negative) to emphasize that something is certainly not the case ('surely not', 'by no means').
まさか彼が犯人なわけがない。
There's no way he's the culprit.
A noun meaning an unexpected event or emergency (used in expressions like 'in case of the unexpected').
まさかの事故で電車が止まり、帰宅が遅くなった。
Due to an unexpected accident the train stopped and I got home late.
As an adverb meaning indeed or unexpectedly — used to express surprise that something actually happened.
まさか彼が本当に来るとは思わなかった。
I didn't think he would actually come.
An archaic/rare usage meaning 'the present moment' or 'the situation at hand' (rarely used in modern Japanese).
古文には『まさかにして』という表現が見られることがある。
In classical texts you can sometimes find the expression 'masaka ni shite'.