The gratuitous grace of miracles

Just as prophecy extends to whatever can be known supernaturally, so the working of miracles extends to all things that can be done supernaturally; the cause whereof is the divine omnipotence which cannot be communicated to any creature. Hence it is impossible for the principle of working miracles to be a quality abiding as a habit in the soul. On the other hand, just as the prophet’s mind is moved by divine inspiration to know something supernaturally, so too is it possible for the mindof the miracle worker to be moved to do something resulting in the miraculous effect which God causes by His power. Sometimes this takes place after prayer, as when Peter raised to life the dead Tabitha (Acts 9:40): sometimes without any previous prayerbeing expressed, as when Peter by upbraiding the lying Ananias and Saphira delivered them to death (Acts 5:4-9). Hence Gregorysays (Dial. ii, 30) that “the saints work miracles, sometimes by authority, sometimes by prayer.” On either case, however, God is the principal worker, for He uses instrumentally either man’s inward movement, or his speech, or some outward action, or again the bodily contact of even a dead body. Thus when Josue had said as though authoritatively (Joshua 10:12): “Move not, O sun, toward Gabaon,” it is said afterwards (Joshua 10:14): “There was not before or after so long a day, the Lord obeying the voice of a man.”

— from Summa Theologiae, Question 178. The grace of miracles.