God directly granted Solomon wisdom. In a dream, God asked Solomon what he desired most, and Solomon asked for wisdom to rule his people justly. God was pleased with his request and gave him not only wisdom but also wealth and honor.
Solomon's wisdom was also shown in his ability to understand people and situations. For example, when the two women came to him with the baby dispute, he was able to figure out the truth by proposing to cut the baby in half. His insight into human nature allowed him to make the right decision and gain a reputation for his wisdom.