The relevent text is Hume's An Enquiry Concerning Human Understanding, Chapter X,
Readings in Modern Philosophy, Volume II (2000), ed. Roger Arew and Eric Watkins.
According to our commonplace understanding, natural laws are inviolable causal laws: If, given A, B always – without exception – occurs, then A → B is a matter of natural law. Hume, however, does not uphold a causal understanding of law. Rather, he believes that there are no necessary connections between events (only their “conjoin[ment]”) and that when we form the impression that such connections exist we are generalizing from our experiences observing regularities in the world (357). If every time we experience event A we then experience event B, we increasingly associate A with B. If we observe this regularity many times without exception, never experiencing an A event without a subsequent B event, we consider it a matter of law that B follows A (even though the causal implication of this notion is a convenient fiction). Examples of such laws are the physical law of gravity, or the fact that the sun always rises in the east.
Hume defines a miracle as an event which is in violation of the laws of nature, contradicting the precedent of our experiences (373). We might, for instance, wake one morning to see the sun rising in the west. When we experience an event that seems to be miraculous, we may respond in two ways: 1) trust that our experience was veridical and interpret the event as a violation of the law; or 2) deny the fact that our experience was veridical and reject our belief that it occurred, or that we properly interpreted it. If 1, we must reject the law that has been violated, or else revise it to sufficiently explain the event. If 2, we needn't revise the law, but need only reject a single, isolated belief (belief in the miracle).
The epistemic cost of 1 is clearly greater than the epistemic cost of 2. So on what condition is it permissible to act in accordance with 1? Obviously we cannot authenticate a miracle solely on the basis of 'seeming real', for to do so would be to reject the precedent of prior experience. But surely there is also some possible circumstance where an event really would countermand one of our laws, either because it was truly aberrant or (more likely) because our law was incorrect. So the question becomes how we know when the experience of a miracle merits this radical reassessment of our greater beliefs.
Hume suggests that we “proportion our belief to the evidence” (371) and err on the side of trusting explanations that explain events in “the greatest number of experiments”, ie hold true in the most experiences. This is to say that we are to rely on standard of belief appraisal that gives credence to a belief relative to its evidential likelihood of being true. We assess this probability by reckoning foremost from the accumulation of our own empirical experiences.
In the case of miracles, our evidence for endorsing a miracle is always going to be weaker than our evidence for dismissing it. This is because miracles by definition contradict the law-like regularities we've gleaned from observation. Hume takes this to mean that the evidence can never be stacked in favour of endorsement; it is part of a miracle's nature that it contradicts so drastically our understanding of the world, after all (373). So according to Hume, because we should believe only that which favours our evidence, we ought never to affirm the validity of a miracle.
Hume then addresses the natural reply that the testimony of others could alter our credence attributions in favour of a miracle, if that testimony were particularly plausible or independently affirmed by multiple people. Hume is willing to acknowledge that the evidence isn't distributed in a binary way (is "not entirely uniform"), being either wholly for or against a miracle. Indeed, the testimony of others can increase the credence we are justified to have in a miracle (372). To what extent testimony can increase credence depends on a number of factors, such as the number and character of the witnesses, the believability of their testimony, and the lack of contrary testimony (372). Yet Hume argues that “no testimony is sufficient to establish a miracle” – even if testimony gave the maximal evidence possible for the authenticity of a miracle, the amount of credence we could justifiably assign to the miracle's authenticity cannot possibly outweigh the empirical evidence of our concepts of natural law (373). Our experiential data weighs so heavily in credence attributions that the probabilistic game is effectively rigged in its favour of the latter.
Although I agree with Hume that endorsing miracles is bad epistemic business, I think his particular argument is vulnerable to certain criticisms. The above ruling on what we should do in cases of peer testimony is in particular not very robust, and I now turn to a possible argument against it.
Where X is an event in the world, there is a finite, though very large, amount of credence we are justified to attribute to the proposition “X conforms with natural law”. In regards to the sum total of our experiences at any moment, this amount of credence is fixed (until we collect more experiences, that is). There is also a finite amount of credence we are justified to attribute to the opposite proposition that “X is a miracle”. This means that there is a fixed difference between the two amounts of credence: there is some measure by which the former surpasses the latter.
Our credence in “X is a miracle” will also increase where there is affirmative testimony, by a degree that is relative to credence-positive considerations such as a large number of witnesses, their trustworthiness or the lack the of contradictory testimony. Because each of these factors causes the credence of “X was a miracle” to increase, if only slightly, there is therefore some theoretical combination and proliferation of these factors' occurrences that cause the credence of “X was a miracle” to close the gap on and even outweigh the credence of ”X conformed with natural law”. This may be a fantastical prospect, entailing that some billions of maximally trustworthy persons endorse the miracle, and nobody says that they do not. Yet even so, the fact remains that there is some possible world at which this state of affairs occurs, and in that world we would be correct, by Hume's own standard, to endorse X as a miracle. And so Hume's conclusion that we should never endorse a miracle is not actually a necessary consequence of his criteria; beliefs acquired based strictly on his criteria will not rule against miracles in every possible world.
Although vulnerable in this way, Hume's schema also has certain strengths, especially considering its historical context. In particular, it is a sort of prototype for modern Bayesian approaches to uncertainty, where we assign credence based on our judgement of a proposition's probability of being true. This kind of framework has the advantage of being able to express a great deal of nuance in terms of evidence that is differently distributed across several competing explanations, none of which demand the immediate abandonment of their competitors. This model is progressive for its time in its capacity to present a spread of evidence in terms richer than simplistic, all-or-nothing models of credence.