What is a miracle? Is it a violation of a law of nature?
Didn't people in the past believe in miracles only because they didn't know much about science?
A miracle may be defined as an event that occurs in nature but that has a cause lying outside nature, that is, a supernatural cause. Miracles are not violations of the laws of nature. The way we know if an event is a miracle is by seeing if it could have been caused by natural forces.
For example, when Jesus changed water to wine (Jn 2:1-11), it would have been impossible for random movements or any other natural stimuli to have effected this transubstantiation. If the water could not have turned into wine by natural means, the change must have had a supernatural cause. Since we know nature could not effect this change, we infer that a miracle took place. In fact, it is precisely because of our knowledge of science that we can identify miracles when they occur.
As C. S. Lewis pointed out, the Virgin Birth is only perceivable as a miracle if one first knows the law of nature that virgins don't normally give birth. Joseph understood this law of nature. When he discovered Mary was pregnant, he initially suspected her of unfaithfulness (Mt 1:19). It took a visit from an angel of the Lord to convince him of the miraculous nature of Mary's pregnancy.
To learn more about how eminently scientific it is to believe in miracles, get hold of these books: Miracles, by C. S. Lewis, Miracles: A Catholic View, by Ralph McInerny, Scaling the Secular City, by J. P. Moreland, and That You May Believe and Miracles and the Critical Mind, both by Colin Brown. Highly recommended are the now out-of-print works of Catholic apologist Arnold Lunn, Revolt Against Reason and And Yet So New.