An angel visits Joseph

Matt 1:19 Then Joseph her husband, being a just man, and not willing to make her a publick example, was minded to put her away privily. 20 But while he thought on these things, behold, the angel of the Lord appeared unto him in a dream [1], saying, Joseph, thou son of David, fear not to take unto thee Mary thy wife: for that which is conceived in her is of the Holy Ghost. 21 And she shall bring forth a son, and thou shalt call his name Jesus: for he shall save his people from their sins.

Matt 1:22 Now all this was done, that it might be fulfilled which was spoken of the Lord by the prophet [2], saying, 23 Behold, a virgin shall be with child, and shall bring forth a son, and they shall call his name Emmanuel [3], which being interpreted is, God with us.

Matt 1:24 Then Joseph being raised from sleep did as the angel of the Lord had bidden him, and took unto him his wife: 25 And knew her not till she had brought forth her firstborn son: and he called his name Jesus.

[1]Only in Matthew does God send revelations in dreams. See also Matthew 2:12-13, 2:19, 2:22, 27:19.

[2]Isaiah 7:14 Therefore the Lord himself shall give you a sign; Behold, a virgin shall conceive, and bear a son, and shall call his name Immanuel. In Isaiah, God is offering Ahaz, king of Judah, a sign that Ahaz' line will survive the Syro-Ephraimite war. The child foretold is born in Isaiah 8:3. Note that, in the original Hebrew, it is not "a virgin" but "a young woman" who is to bear a son (New Oxford Annotated Bible, p. 831)

[3]Jesus is not referred to as Emmanuel anywhere else in the gospels.