I think it's more likely that those miracles were invented for propaganda reasons in the period between the crucification and when the New Testament was finalized. For instance there's a whole lot of apocryphal texts (e.g. [1]) about Jesus as a child where he performed all sorts of miracles, but I guess those were considered a bit too over the top even for 1st millenium standards and thus hadn't been included in the official Bible.
In Jesus' time and region there were miracle workers by the hundreds, and he was just seen as another one of them. They travelled form village to village performing miracles in exchange for, I guess, money and food. If I'm not mistaken, on what I read about the historical Jesus, the difference was that he didn't charge for the miracles, but I could be wrong here, don't remember much.
By the time Paul was writing a few years after the crucifixion, the Jesus movement already believed God raised him from the dead, which made him the exalted messiah in their minds. So it's not too far a stretch to think they believed he also performed miracles while alive. In the Hebrew scriptures/OT, Jewish prophets performed miracles. Why not Jesus?
In the canonical gospel accounts, God's spirit enters Jesus when John baptizes him. Then he starts his ministry which includes miracle working. The disciples did the same thing in Acts after receiving the spirit. There is an even a false prophet (from the Christian POV), Simon Magus, who could perform some miracles.
There was widespread belief in miracle working in the ancient world. It meant the miracle worker had been empowered by the gods, or was a son of a god (or Yahweh in the case of Jesus).
How do you know? What other historical documents did he write that we can compare to what we now understand of the historical record, in order to judge his quality as a historian?
We know because we can check a bunch of what he wrote. Not everything - not the miracles, not the resurrection - but we can check a bunch of the background details against known secular history.
When Luke wants to locate the start of John the Baptist's ministry in time, he says, "In the fifteenth year of the reign of Tiberius Caesar, Pontius Pilate being governor of Judea, and Herod being tetrarch of Galilee, and his brother Philip tetrarch of the region of Ituraea and Trachonitis, and Lysanias tetrarch of Abilene, during the high priesthood of Annas and Caiaphas, the word of God came to John the son of Zechariah in the wilderness." We can check that all those people were in those positions at the time Luke said they were. He's tying the events he's narrating to a specific, concrete historical setting.
One little thing that I notice: When he's writing Acts, Luke is at times part of the events. He's describing Paul's travels, but sometimes it's "he", and sometimes it's "we" - that is, Luke is traveling with Paul. And whenever it's "we", the level of detail goes up. The ship had this figurehead. Here's where we sailed, day by day. But when Luke's not part of the party, he doesn't know at that level of detail, and he doesn't say what he doesn't know. That's a careful writer.
The distinction that I would make is that Christians view miracles as an intelligent being choosing to temporarily circumvent the laws of nature. That is in contrast to rituals or magical substances which are believed to directly influence the laws of nature.
From a theological perspective (which may not be the same as how a given lay Christian thinks about things) prayer is simply asking God to perform a miracle for you in the same way that you might ask a human to do a favor for you. Similarly, Christian ritual is seen as intended to help humans have faith, not as having any magical properties in of themselves.
[1] https://en.wikipedia.org/wiki/Infancy_Gospel_of_Thomas