You can use magic when you are referring to an event that is so wonderful, strange, or unexpected that it seems as if supernatural powers have caused it.
魔法
You use magic to describe something that does things, or appears to do things, by magic.
有魔力的
All this was supposed to work like magic.
这一切应该魔法般地起作用。