The problem of pain is often used by laymen as an instrument to attack God's goodness, His existence, or both and it used to be considered by most philosophers and theologians to be the strongest such attack. For whatever reason this question always adopts a narrow perspective which leads to a false conclusion. Drawing conclusions from narrow perspectives is like zooming in on one of the few downhill sections on the trail up Mt. Whitney, and concluding that it is a downhill stroll to the top of the mountain.
To come to the correct conclusion regarding the nature of the trail up the mountain you have to look at the entire trail. Similarly to come to the correct conclusion regarding the experience of pain in life you have to look at the entire life and ask yourself the question: As a human being, is being better than not being? All people who call themselves rational and have not taken their own life must answer in the affirmative. If you answer in the affirmative, then the goodness of our life and existence outweighs the badness and God is probably good. The bad we experience is a necessary consequence of our free will, which enables both good and bad; and is itself, a superior good.
It is still very interesting that God would make us with free will. Why not make us God-glorifying automatons? Well... maybe he was bored of making those☺ as that is how He made the vast majority of the universe. The heavens declare the glory of God and they have absolutely no choice in the matter.