Problem: Matthew writes, “He did not do many miracles there because of their unbelief” (Mt. 13:58). Did Jesus need people to believe in him in order for him to perform miracles?
Solution: Jesus is not Tinkerbell, who needed people to believe in him in order to perform miracles. This passage states that Jesus did not do miracles—not that he could not do them.
However, Mark 6:5 states, “[Jesus] could do no miracle.” This shouldn’t be taken as an absolute statement. Of course, this didn’t stop Jesus from healing “a few sick people.” Moreover, Mark records other instances where Jesus performed miracles without any faith, including the feeding of the 5,000, the calming of the storm, and the healing of the demon possessed. Elsewhere in Matthew, Jesus calls his audience an “unbelieving and perverted generation,” and yet, he still heals them (Mt. 17:17).
When Mark says that Jesus could not perform miracles, this was not because of his ability; but rather, this was due to his mission. It is the same logical impossibility of God saving humanity without the Cross (Mt. 26:39). Carson writes, “The ‘could not’ is related to Jesus’ mission: just as Jesus could not turn stones to bread without violating his mission (Mt. 4:14), so he could not do miracles indiscriminately without turning his mission into a sideshow.”
 Carson, D. A. (1984). Matthew. In F. E. Gaebelein (Ed.), The Expositor’s Bible Commentary: Matthew, Mark, Luke (Vol. 8, p. 336). Grand Rapids, MI: Zondervan Publishing House.