Anyone can ask God confidently for wisdom (James 1:5); it is a product of ‘the fear of the Lord’ (Job 28:28). But the spiritual gift of wisdom is slightly different; it is, in fact, a ‘word of wisdom’ (I Corinthians 12:8). This is what the Spirit will give us in order to defend our faith (Luke 21:14,15), or perhaps to settle a dispute (I Kings 3:16-28). This was how Stephen was able to hold his own in debate with unbelieving Jews – “they could not stand up against the wisdom the Spirit gave him as he spoke” (Acts 6:10).
A word of knowledge is something slightly different. It is a supernatural knowledge of the truth of a situation, or of the thoughts in someone’s heart, and it enables the Holy Spirit to use us to convict someone of sin or to expose hypocrisy. A good Biblical example is when Peter confronted Ananias and Sapphire (Acts 5:1-5). What they had done was done in secret, and known only to themselves; but Peter’s inspired words made their sin public and pronounced God’s judgement on it.