Perhaps it is the intention of the petitioner. When someone is helped through a prayer for grace (to overcome evil) it is a miracle. Conversely, when the person petitions for illicit gain, preternatural power over others or harm to one's enemies, the only method is magic which is the exclusively the work of the Devil.
What about instances, where there is no petitioner?