Surely the preceding verses give sufficient context?
Now concerning spiritual gifts, brethren, I do not want you to be unaware. You know that when you were pagans, you were led astray to the mute idols, however you were led. Therefore I make known to you that no one speaking by the Spirit of God says, "Jesus is accursed"; and no one can say, "Jesus is Lord," except by the Holy Spirit. Now there are varieties of gifts, but the same Spirit. And there are varieties of ministries, and the same Lord. There are varieties of effects, but the same God who works all things in all persons. But to each one is given the manifestation of the Spirit for the common good. For to one is given ...
(1 Cor 12:1-8a, NASB)
The "therefore" in v3 indicates a connection between the fact that the ex-pagans used to be led astray and the explanation as to how to distinguish between someone speaking by the Spirit of God and someone who isn't. The passage then goes on to explain that there is one Spirit who gives all the charismata. It seems fairly clear that Paul is concerned that some in the Corinthian church may be producing ecstatic utterances under the influence of pagan spirits or may have carried over the pagan idea of many gods each with their own particular speciality.
If we take v3 then to be about distinguishing between utterances produced under the influence of the Holy Spirit vs other spirits, the gift of v10 is simply a supernatural extension of an ability which all Christians should have. (Cf. 1 Cor 6:3: if the saints will judge angels, they should be able to distinguish the Holy Spirit from other spirits!)
Anticipating a possible objection, there's no contradiction between "all Christians can do it" and "there's a specific gift of the Holy Spirit to do it, which only some Christians have". Compare what Romans says about charismata:
Since we have gifts that differ according to the grace given to us, each of us is to exercise them accordingly: ... he who gives, with liberality...
(Rom 12:6a, 8b, NASB)
and then within a couple of verses
Be devoted to one another in brotherly love... contributing to the needs of the saints...
(Rom 12:10a, 13a, NASB)
All should give, and those who have a gift of giving should exercise it. Similarly in 1 Cor 12, all should know how to distinguish utterance in the Holy Spirit from utterance in other spirits, and those who have a gift in that area have received it for the common good.