By prayer we can discern "what is the will of God" and obtain the endurance to do it. Jesus teaches us that one enters the kingdom of heaven not by speaking words, but by doing "the will of my Father in heaven."
Source: Catechism of the Catholic Church (Vatican.va)