And a great sign appeared in heaven: a woman clothed with the sun, with the moon under her feet, and on her head a crown of twelve stars. 2 She was pregnant and was crying out in birth pains and the agony of giving birth. 3 And another sign appeared in heaven: behold, a great red dragon, with seven heads and ten horns, and on his heads seven diadems. 4 His tail swept down a third of the stars of heaven and cast them to the earth. And the dragon stood before the woman who was about to give birth, so that when she bore her child he might devour it. 5 She gave birth to a manchild, one who is to rule all the nations with a rod of iron, but her child was caught up to God and to his throne, 6 and the woman fled into the wilderness, where she has a place prepared by God, in which she is to be nourished for 1,260 days (Rev 12:1-6).
Critics say Matthew invented the nativity stories. In particular, they say he began with messianic prophecies, then concocted stories to make Jesus fulfill the prophecies. But there are multiple problems with that objection:
i) The same critics say Matthew is quoting OT passages out of context. His prooftexts are ill-fitted to illustrate his stories. If, however, Matthew fabricated the stories, then he could make the details exactly match his chosen prooftexts. If, conversely, they don't seem to line up in a straightforward fashion, that's because Matthew is constrained by biographical facts about Jesus.
ii) If Matthew invented the nativity stories, we'd expect a string of stand-alone vignettes. They wouldn't be related to each other, but related to the prooftexts.
By contrast, what we actually have in Mt 2 is a series of events in which one thing leads to another by cause and effect. Because the Magi witness a celestial portent or prodigy, they journey to the Holy Land. Because they lack sufficient information to pinpoint the address, they go to the capital to seek directions. Because they ask, that tips off the paranoid Herod about a perceived rival to the throne. Because Herod is alerted to the threat, he dispatches soldiers to assassinate the child. Because a death squad is on the way, Joseph must spirit the child out of Herod's jurisdiction. Because Herod dies, Joseph is free to return to Israel, but because Herod's son is ruling in his father's place, Joseph relocates the family to an region outside his successor's jurisdiction.
But if the incidents in chap 2 were made up in reference to isolated prooftexts, we'd expect a string of isolated vignettes. These would be self-contained little stories about unrelated incidents in the life of the Christchild, rather than a consistent plot development.
iii) Finally, Rev 12 may well afford independent corroboration for Mt 2. It's hard for a reader who's familiar with the events in Mt 2 not to be reminded of the same thing in Rev 12. Herod is the dragon whose endeavor to liquidate the newborn child forces the Holy Family to take refuge in Egypt. I'm not suggesting that Rev 12 is reducible to that background event. It's a multilayered text with many allusions. But between Mt 2 and Rev 12, we have multiple attestation for the plot to bump off the Christchild.