Matthew tells the story of how Jesus came to be born. The birth is surrounded in mystery and the direct action of God. Matthew sees this as a reflection of the divine intervention of God in the life of Israel in the Old Testament; the Holy Spirit is involved, there are dreams and portents, the same as was present in Old Testament births of prophets.
Matthew is setting the scene that the birth of someone special is about to take place. The words of the prophet have to be fulfilled; his very name means "God is with us."
The reader is left with this question. Who shall this child turn out to be?