Secondly, he says: To another the working of miracles, by which a person is persuaded solely by the greatness of the deed; for example, when the sea was divided, as we read in Ex (14:21), or when the sun and moon stood still in the heavens, as we read in Joshua (10:13). "Who has given you the Spirit and works marvels among you?" (Gal 3:5). In another way a divine sign is based on something God alone can know, i.e., the future contingent, as it says in Is (41:23): "Tell us what is to come hereafter, that we may know that you are gods." As to this he says: to another is given prophecy, which is ...divine revelation declaring with unchangeable truth among events: "I will pour out my Spirit on all flesh, and your sons and your daughters shall prophesy" (Jl 2:28). Another is knowledge of the human heart, as in Jer (17:9): "The heart is deceitful above all things and desperately corrupt; who can understand it? I, the Lord, search the mind and try the heart." In regard to this he says: To another the ability to distinguish between spirits, namely, in order that a man be able to discern by what spirit someone is moved to speak or work; for example, whether by the spirit of charity or by the spirit of envy: "Do not believe every spirit, but test the spirits to see whether they are of God" (1 Jn 4:1).
But the faculty of speaking persuasively consists in being able to speak intelligibly to others. This can be prevented in two ways: in one way by a diversity of dialects. Against this is applied the remedy signified by what he says: to another is given various kinds of tongues, namely, in order that he be able to speak in diverse languages, so that he will be understood by all, as it says of the apostles in Ac (2:4) that they spoke in various languages. In another way by the obscurity of a scripture to be quoted. Against this is given the remedy he mentions: to another the interpretation of tongues, i.e., of difficult scriptures: "I have heard that you can give interpretations of obscure things" (Dan 5:16); "Do not interpretations belong to God?" (Gen 40:8).
Source: Commentary on 1 Corinthians